var dtTime;

function buildRel(btn,entity2,fn_id,fns){
	var grid = btn.up('bat_grid');
	var ui=grid.ui;
	 var ui1=ui.ui1;
	 if(!ui1)
	 	return;
	 var sels=grid.getSelectionModel().getSelection();
	if(!sels) return;
	 var tobjs = ui1.objs;
	 var robj = ui1.robj;
	 var entity1,kv1;
	
	 entity1 = robj.cns[0];	

	 var kn = 'id';
	//考虑到中英文表的情况
	 kv1 = robj.items.map[kn]||robj.items.map['A.'+kn];
	 var dobj = tobjs[0];
	 var appendObjs=[];
	for(var i=0; i<sels.length; i++){
		var tobj = Bat.clone(dobj);
		tobj.action='A';
		var o = sels[i].obj;
		o.action = "R";
		tobj.items.map['A.entity1']=entity1 ;
		tobj.items.map['A.id1']=kv1;
		tobj.items.map['A.entity2']=entity2;
		tobj.items.map['A.id2']=o.items.map[fn_id];
		tobj.items.map['A.ord']=tobjs.length-1;
		for(var j=0; j<fns.length; j++){
			var fn = fns[j];
			var pos = fn.indexOf('.');
			var fno = (pos==-1)?fn:fn.substring(pos+1);
			//由于关联视图保存时,从对象没有id,不保存,增加一些属性不会出问题
			tobj.items.map['B.'+fno]=o.items.map[fn];
		}
		tobjs[tobjs.length]=tobj;
		appendObjs[appendObjs.length]=tobj;
	}
	
	ui.reload = false;
	ui.ds.load();
	if(ui1.grid.renderfunc){
		ui1.grid.renderfunc(ui1.grid.body,ui1,appendObjs);
	}else{
		ui1.reload = false;
		ui1.ds.load();
		//ui1.grid.getSelectionModel().selectLastRow();
	}
}


BView.btns={
	"json_cls":	{text:'json',
		cls: 'x-btn-text-icon',
		menu:{items:[{
	   		text: '导出',
	        cls: 'x-btn-text-icon',
	        icon: 'icons/disk.png',
			handler : function(btn){
		var robj = btn.ui.robj;
		   Ext.MessageBox.wait({
	           title: 'Please wait',
	           msg: 'Loading items...'
	       });
	       var im = robj.items.map;
		  var req={"map":{nid:im.id},"javaClass":"java.util.HashMap"};
		  jsonrpc.BH.handle(function(data,ex){
	   		if(Bat.outputEx(ex,'生成JSon异常')){
	   			return;
	   		}
			Ext.Msg.show({
			   title:'JSon output complete',
			   msg:data,
			   buttons: Ext.Msg.OK,
			   icon: Ext.MessageBox.INFO
			});	   		
	   		//Ext.MessageBox.hide();
	   		//var fn = im.id  +"_cls_"+im.language+".json";
	   		//var jwin = window.open("../servlet/fu?f="+im.uid+"\\json\\"+fn);
		  },'S',req,'RMService');            	
 		
	}},{
	text: '导入',
    cls: 'x-btn-text-icon',
    icon: 'icons/add.png',
	handler : function(btn){
		//TODO
	}				
	}]}},
	"json":	{text:'json',
		cls: 'x-btn-text-icon',
		menu:{items:[{
	   		text: '导出内容',
	        cls: 'x-btn-text-icon',
	        icon: 'icons/disk.png',
			handler : function(btn){
			  var filter;
			  var sels=btn.ui.grid.getSelectionModel().getSelections();
			  if(!sels || sels.length==0){
		        Ext.MessageBox.show({
		           title: '系统提示',
		           msg: '请先选中一条记录',
		           buttons: Ext.MessageBox.OK,
		           icon: Ext.MessageBox.INFO
		       });
			  	return;
			  }
			var selmap = sels[0].obj.items.map;
			filter = "from NBase where id="+selmap.id;
		   Ext.MessageBox.show({
	           title: 'Please wait...',
	           msg: 'Loading items...',
	           progressText: 'Initializing...',
	           width:300,
	           progress:true,
	           closable:true
	           //animEl: 'mb6'
	       });
	  var req={"map":layout.usr_info,"javaClass":"java.util.HashMap"};
	  jsonrpc.BH.handle(function(data,ex){
   		if(Bat.outputEx(ex,'建立任务异常'))
   			return;
   		
		  var req={"map":{tid:data,filter:filter,bcover:false},"javaClass":"java.util.HashMap"};
		  jsonrpc.BH.handle(function(data,ex){
	   		if(Bat.outputEx(ex,'生成JSon异常')){
	   			//Ext.MessageBox.hide();
	   			return;
	   		}
			Ext.Msg.show({
			   title:'JSon output complete',
			   msg:data,
			   buttons: Ext.Msg.OK,
			   icon: Ext.MessageBox.INFO
			});	   		
		  },'J',req,'RMService');            	

   			
   		},'N',req,'TaskHandle');            	
		
	}},{
	text: '导出封面',
    cls: 'x-btn-text-icon',
    icon: 'icons/add.png',
	handler : function(btn){
	  var req={"map":layout.usr_info,"javaClass":"java.util.HashMap"};
	  jsonrpc.BH.handle(function(data,ex){
   		if(Bat.outputEx(ex,'建立任务异常'))
   			return;
   		
		  var req={"map":{tid:data,bcover:true},"javaClass":"java.util.HashMap"};
		  jsonrpc.BH.handle(function(data,ex){
	   		if(Bat.outputEx(ex,'生成JSon异常')){
	   			//Ext.MessageBox.hide();
	   			return;
	   		}
			Ext.Msg.show({
			   title:'JSon output complete',
			   msg:data,
			   buttons: Ext.Msg.OK,
			   icon: Ext.MessageBox.INFO
			});	   		
		  },'J',req,'RMService');            	

   			
   		},'N',req,'TaskHandle');            	
	}				
	}]}},
	
 "copyto":{
	text: Bat.info.mnu_copyto_title,
    cls: 'x-btn-text-icon',
    icon: 'icons/disk_multiple.png',
	handler : function(btn){		
      var ui=btn.ui;
	  var sels=btn.ui.grid.getSelectionModel().getSelections();
	  var bsel = sels && sels.length>0;
	  if(!bsel){
	  	return;
	  }
	  var title = (bsel?Bat.info.mnu_copyto_sel:Bat.info.mnu_copyto_flt)+Bat.info.mnu_copyto_title;
		Ext.Msg.prompt(title,Bat.info.mnu_copyto_rtid, function(btn, text){
		   if (btn == 'ok'){
		        // process text value and close...
		   	var ids=[];
		   	var rtid=text;
	  		for(var i=0; i<sels.length; i++){
	  			var im = sels[i].obj.items.map;
	  			ids[ids.length]=im.id;
	  		}

		   Ext.MessageBox.show({
	           title: 'Please wait',
	           msg: 'Loading items...',
	           progressText: 'Initializing...',
	           width:300,
	           progress:true,
	           closable:true
	           //animEl: 'mb6'
	       });
	  var req={"map":layout.usr_info,"javaClass":"java.util.HashMap"};
	  jsonrpc.BH.handle(function(data,ex){
   		if(Bat.outputEx(ex,'建立任务异常'))
   			return;
   		
		  var req={"map":{tid:data,ids:ids,rtid:rtid},"javaClass":"java.util.HashMap"};
		  jsonrpc.BH.handle(function(data,ex){
	   		if(Bat.outputEx(ex,'复制菜单异常')){
	   			//Ext.MessageBox.hide();
	   			return;
	   		}
	   		Ext.MessageBox.hide();
		  },'C',req,'RMService');            	
   		},'N',req,'TaskHandle');            		  			  		
		   }
		});
}}
}

BView.viewMap={
"dao.hb.UOrg":{
	  req:{
		  "pss":[["oid","version","name","pid","id","ord","status","dtCreate","dtModify","uid"]],
		  "cns":["dao.hb.UOrg"],
		  "hql":"from UOrg"
	  },
	
	  cfg_prop:{
		  "oid":{
			  display:"机构编号"
		  },
		  "version":{
			  display:"版本"
		  },
		  "name":{
			  display:"名称"
		  },
		  "pid":{
			  display:"上机机构"
		  },
		  "id":{
			  display:"编号"
		  },
		  "ord":{
			  display:"排序"
		  },
		  "status":{
			  display:"状态"
		  },
		  "dtCreate":{
			  editor:"DateField",
			  display:'建立时间'
		  },
		  "dtModify":{
			  editor:"DateField",
			  display:'修改时间'
		  },
		  "uid":{
			  display:"创建人编号"
		  }
	  }
	  ,cfg_detail:{
			btns:["保存"],
			tabs:[{
				title : "基本信息",
				fset : [{
					legend : "",
					props :["oid","version","name","pid","id","ord","status","dtCreate","dtModify","uid"]
				}]
				}]},
			cfg_grid:{
				btns:['增加','删除','打开','保存','检索','刷新','排序']
			}
  },	
"rel_user":{
	req:{
		"pss" : [["id","entity1", "id1","entity2","id2","ord","dtCreate"],['name','avatar']],
		"cns" : ["dao.hb.RRel","dao.hb.UUser"],
		"hql" : "from RRel A, UUser B where A.entity2='dao.hb.UUser' and A.id2=B.id order by A.ord"
	},
	cfg_detail:{
		btns:["保存"]
	},	
	cfg_grid:{
		btns:['删除','保存','检索','刷新','排序']
	},
	cfg_prop:{
	"A.id":{
	  display:'序号',
	  cfg:{
	  	readOnly:true
	  }
	},
	"A.id1":{
	 	display:"id1",
	 	hidden:true
	},
	"A.id2":{
	 	display:"id2",
	 	hidden:true
	},
	"A.ord":{
	 	display:"顺序"
	},
	"A.entity1":{
	 	display:"entity1",
	 	hidden:true
	},
	"A.entity2":{
	 	display:"entity2",
	 	hidden:true
	},
	"B.name":{
	 display:"用户名"
	},	
	"B.avatar":{
	  display:'用户头像',
	  	cfg:{readOnly:true},
	  	editor:'DisplayField',
	  	renderer : function(itxt,r,col,l) {	
	  		var src=itxt?"/ylbx/servlet/fu?f="+itxt:'icons/avatar.png';
	  		var its = r.record?r.record.data:r.item||{};
	  		return "<img style='cursor:hand;' src='"+src+"' title='"+ its['B.name']
	  		+"' onclick='layout.renderDetailByKey(\"dao.hb.UUser\",false,"+its['A.id2']+");return false;'/>";
		}
	 },
	 "pid":{
	 display:"父节点"
	},"A.dtCreate":{
	  editor:"DateField",
	  display:'建立时间',
	  cfg:{
		readOnly:true
	 	}  
	 }
	}
 },	
	
 "dao.hb.PProject":{
	req:{
		"pss" : [["id","uid", "aid","stype", "name","keyname","status","dtDue","dtCreate","dtModify","summery"]],
		"cns" : ["dao.hb.PProject"],
		"hql" : "from PProject"
	},
	cfg_detail:{
	btns:["保存"],
	tabs:[{
		title : "基本信息",
		fset : [{
			legend : "",
			props :["id","uid", "aid","stype", "name","keyname","status","dtDue","dtCreate","dtModify"]
		
		},{
		
			legend : "",
			props :["summery"]
		}]
	}]},
	cfg_grid:{
		btns:['录入','删除','打开','保存','检索','刷新','排序']
	},
	cfg_prop:{
	"aid":{
		 display:"负责人",
		 editor : 'ComboBox',
		 cfg :BView.func_cfg_combo_hql("select A.id,A.name from UUser A,RRel B where A.id=B.id2 and B.entity1='dao.hb.PProject'  and B.entity2='dao.hb.UUser'  order by B.ord","id")
	},
	"uid":{
		 display:"录入",
		 editor : 'ComboBox',
		  dcfg:{
			readOnly:true
		 },
		 cfg :BView.func_cfg_combo_hql("select A.id,A.name from UUser A,RRel B where A.id=B.id2 and B.entity1='dao.hb.PProject'  and B.entity2='dao.hb.UUser'  order by B.ord","id")
	},
	"id":{
	  display:'序号',
	  cfg:{
	  	readOnly:true
	  }
	},
	"status":{
		width:90,
	 	display:"阶段",
		editor : 'ComboBox',
		cfg :BView.func_cfg_combo([['需求调研', '需求调研'], ['设计', '设计'], ['编码', '编码'], ['测试', '测试'],['部署', '部署'],['完成', '完成']])
	},
	"dtDue":{
	  editor:"DateField",
	  display:'交付时间'
	},
	"dtModify":{
	  editor:"DateField",
	  display:'更新时间',
	  cfg:{
	  	readOnly:true
	  }
	},	
	"dtCreate":{
	  editor:"DateField",
	  display:'建立时间',
	  cfg:{
	  	readOnly:true
	  }
	},"summery":{
	  display:'备注',
	  editor:"TextArea",
	    dcfg:{
			  allowBlank:false
		  }
	},"keyname":{
	  display:'代号'
	},"name":{
	  display:'名称',
	    dcfg:{
			  allowBlank:false
		  }
	},
	"stype":{
	 	display:"分类",
		editor : 'ComboBox',
		cfg :BView.func_cfg_combo([['外包', '外包'], ['外派', '外派'], ['预研', '预研'], ['合同', '合同']])
	}
  },child_views : [{
  	title:"项目任务",
  	vn:"dao.hb.PTask",
	func_filter: function(robj, ui) {
		var cn = robj.cns[0];
		var hql = " from PTask where pid=" + (robj.items.map['id'] || 0)+" order by id";		
		ui.setHQL(hql);
	},
	func_setdefault:function(robj,objs){
		objs[0].items.map["pid"]=robj.items.map['id'];
	}
  },{
  	title:"相关附件",
  	vn:"dao.hb.OAttachment",
	func_filter: function(robj, ui) {
		var cn = robj.cns[0];
		var hql = " from OAttachment where entityName='"
		+ robj.cns[0]+"' and entityId=" + (robj.items.map['id'] || 0);		
		ui.setHQL(hql);
	},
	func_setdefault:function(robj,objs){
		objs[0].items.map["entityName"]="dao.hb.PProject";
		objs[0].items.map["entityId"]=robj.items.map['id'];
	}
  }],
     rel_views:[{
  	title:"项目人员",
  	vt:{
  		title:"已选人员",
		vn : 'rel_user',
		func_filter : function(robj, ui) {
			var hql = " from RRel A , UUser B where B.id=A.id2 and A.entity1='dao.hb.PProject' and A.entity2='dao.hb.UUser' and A.id1="
					+ (robj.items.map['id']||robj.items.map['A.id']||0) +" order by A.ord";
			ui.setHQL(hql);
		},
    	func_view :function(vw){
      		var btns=['打开','增加', '删除', '保存'];
     	}
  	},
  	vs:{
  		vn:"dao.hb.UUser",
  		title:"可选人员",
  		func_filter : function(robj, ui) {
			//var hql = "from dao.hb.UUser order by id desc  ";
			var hql="from UUser  where id not in ( select id2 from RRel where entity1='dao.hb.PProject' and entity2='dao.hb.UUser' and id1="+(robj.items.map['id'] || 0)+") ";
			ui.setHQL(hql);
		},
		func_view :function(vw){
			vw.cfg_grid.btns=['检索','刷新','排序',{
		   		text: '添加人员',
		   		iconCls: 'plugin_add',
				handler : function(btn){
			    	buildRel(btn,'dao.hb.UUser','id',['name',"avatar"]);
			    }
			 }];
		}

  	}
  }]
 
 },	
 "dao.hb.PTask":{
  	handles:{'before_setobj_detail':function(ui,editors,obj){
  		//editors['dtResolved'][0].setReadOnly(false);
/*  		if(layout.uid==obj.items.map['uid'])
  			BView.setEnableFields(editors,['id','status','resolved'],false);
  		else
  			BView.setEnableFields(editors,['status','resolved'],true);
*/     }
  	},
	req:{
		"pss" : [["id","uid", "pid","cid","tid","aid","stype", "name","priority","status","resolved","dtDue","dtCreate","dtModify","dtResolved","summery"]],
		"cns" : ["dao.hb.PTask"],
		"hql" : "from PTask"
	},
	cfg_detail:{
	btns:["保存"],
	tabs:[{
		title : "基本信息",
		fset : [{
			legend : "",
			props :["id","uid", "pid","cid","tid","aid","stype", "name","priority","status","resolved","dtDue","dtCreate","dtModify","dtResolved"]
		}]
		},{
		title : "备注",
		fset : [{
			legend : "",
			props :["summery"]
		}]
	}]},
	cfg_grid:{
		btns:['增加','删除','打开','保存','检索','刷新','排序']
	},
	cfg_prop:{
	"dtDue":{
	  editor:"DateField",
	  display:'交付时间'
	},
	"uid":{
		 display:"录入",
		 editor : 'ComboBox',
		  dcfg:{
			readOnly:true
		 },
		 cfg :BView.func_cfg_combo_hql("select A.id,A.name from UUser A,RRel B where A.id=B.id2 and B.entity1='dao.hb.PProject'  and B.entity2='dao.hb.UUser'  order by B.ord","id")
	},
	"priority":{
	 	display:"优先级",
		editor : 'ComboBox',
		cfg :BView.func_cfg_combo([['Blocker', 'Blocker'], ['Critical', 'Critical'], ['Major', 'Major'], ['Minor', 'Minor'], ['Trivial', 'Trivial']])
	},
	"stype":{
	 	display:"分类",
		editor : 'ComboBox',
		width:80,
		cfg :BView.func_cfg_combo([['新任务', '新任务'],['新功能', '新功能'],['建议', '建议'], ['测试bug', '测试bug'], ['功能增强', '功能增强']])
	},
	"id":{
	  display:'序号',
	  cfg:{
	  	readOnly:true
	  }
	},
	"aid":{
		 display:"负责人",
		 editor : 'ComboBox',
		 cfg :BView.func_cfg_combo_hql("select A.id,A.name from UUser A,RRel B where A.id=B.id2 and B.entity1='dao.hb.PProject'  and B.entity2='dao.hb.UUser'  order by B.ord","id",
		 {
		 	listeners: {
		 		'beforequery':{
		 			fn:function(queryPlan, eOpts){
		 				var cbo =queryPlan.combo; 
		 				//var ourl=cbo.store.proxy.url;
		 				var	baseurl = CFG.app_ctx+"servlet/JSonBaseServlet?hql=";
		 				cbo.store.proxy.url = baseurl+"select A.id,A.name from UUser A,RRel B where A.id=B.id2 and B.entity1='dao.hb.PProject'  and B.entity2='dao.hb.UUser' and B.id1="
		 					+cbo.item['pid']+"  order by B.ord";
		 				cbo.store.load();
		 				//cbo.store.proxy.url=ourl;
		 			}
		 		}
		 	}
		 }
		 )
	},"status":{
	 display:"状态",
		editor : 'ComboBox',
		cfg :BView.func_cfg_combo([['打开','打开'],['处理中','处理中'],['重新打开','重新打开'],['已解决','已解决'],['关闭','关闭'],['暂缓','暂缓'], ['拒绝', '拒绝']])
	},"resolved":{
	 display:"处理结果",
		editor : 'ComboBox',
		cfg :BView.func_cfg_combo([['完成修改', '完成修改'], ['无法修改', '无法修改'], ['重复问题', '重复问题'], ['描述不清', '描述不清']
		, ['无法重现', '无法重现'], ['部分修改', '部分修改'], ['测试完成', '测试完成'], ['测试未完成', '测试未完成'], ['暂停', '暂停']])
	},"dtModify":{
	  editor:"DateField",
	  display:'更新时间',
	  dcfg:{
		readOnly:true
	 }
	},"dtCreate":{
	  editor:"DateField",
	  display:'建立时间',
	  dcfg:{
		readOnly:true
	 }
	},"dtResolved":{
	  editor:"DateField",
	  display:'解决时间',
	  dcfg:{
		readOnly:true
	 }
	},"summery":{
	  display:'备注',
	  editor:"TA",
	  cfg:{
	  	menuHeight:150,
	  	menuWidth:300,
	  	func_insert:function(data){
	  		return data['name'];
	  	},
	  	func_filterBy:function(rd,str){
			return rd.get('pyh').indexOf(str)==0;
		},
		ds:{
	        fields: ['name','pyh','org'],
	        proxy: {
	           //异步获取数据，这里的URL可以改为任何动态页面，只要返回JSON数据即可
	            type: 'ajax',
	            url: CFG.app_ctx+'servlet/JSonBaseServlet?hql='+'select A.name,A.namePyh,B.name from UUser A,UOrg B where A.oid=B.id',
	            
	            reader: {
	                type: 'array',
	                root: 'list'
	            }
	        },
	        autoLoad: true
	    },
	  columns: [
	        { text: 'name', dataIndex: 'name'},
	        { text: 'pyh', dataIndex: 'pyh' },
	        { text: 'org', dataIndex: 'org' }
	    ]
	}	
	},"name":{
	  display:'名称',
	  width:150
	}
  },child_views : [{
  	title:"子任务",
  	vn:"dao.hb.PTask",
	func_filter: function(robj, ui) {
		var cn = robj.cns[0];
		var hql = " from PTask where tid=" + (robj.items.map['id'] || 0)+" order by id";		
		ui.setHQL(hql);
	},
	func_setdefault:function(robj,objs){
		objs[0].items.map["tid"]=robj.items.map['id'];
	}
  },{
  	title:"相关附件",
  	vn:"dao.hb.OAttachment",
	func_filter: function(robj, ui) {
		var cn = robj.cns[0];
		var hql = " from OAttachment where entityName='"
		+ robj.cns[0]+"' and entityId=" + (robj.items.map['id'] || 0);		
		ui.setHQL(hql);
	},
	func_setdefault:function(robj,objs){
		objs[0].items.map["entityName"]="dao.hb.PProject";
		objs[0].items.map["entityId"]=robj.items.map['id'];
	}
  }]
 },	
		
 "dao.hb.BxDetailrecordCheck":{
 	handles:{'before_setobj_detail':function(ui,editors,obj){
 		var type=obj.items.map.bxType;
 		if(type=="计划生育"){
 		   editors['payAll'][0].setReadOnly(true);
 		}else{
 		   editors['payAll'][0].setReadOnly(false);
 		}
    },
  	'refresh_data':function(ui){
 		if(!ui.b_append)
 			return false;
 		ui.b_append=false;
 		console.log('refresh_data');
 		var pui = ui.grid.ui;
		var objs = pui.objs;
		var o = Bat.clone(objs[0]);
		o.action = "A";
		objs[objs.length] = o;
		pui.reload = false;
		pui.ds.load();
		pui.renderDetailPanel(o);
  	}},
	 req:{
		 "pss":[["id","uid","bxsrPid","bxType","payOne","payTwo","payAll","topMoney","dtLook","reason","bxCost","remark","prebxCost","preRemark","dtCreate","dtModify"]],
		 "cns":["dao.hb.BxDetailrecord"],
		 "hql":"from BxDetailrecord"
	 },
	 cfg_detail:{
			btns:["保存","保存下一条"],
			tabs:[{
				title : "基本信息",
				fset : [{
					legend : "",
					props :["bxType","payOne","topMoney","payTwo","payAll","dtLook"]
				}
				,{
					legend : "",
					props :["bxCost","remark","dtCreate","dtModify"]
				}]
	 }]},
	  cfg_grid:{
	  propFilter:["uid","dtLook"],
      btns : [ '录入', '提示删除','检索', '刷新', {
        text : '计算报销金额',
        cls : 'x-btn-text-icon',
        icon : 'icons/fam/book.png',
        handler : function(btn) {
        	var ui=BView.getUi(btn);
            var bxsrid = ui.objs[1].its.bxsrPid;
            Ext.MessageBox.confirm("确认","您确定单据无误并计算报销费用吗？",function(btn){
            if(btn=="no"){
                   return;
            }else {
              var req = {
                "map" : {id : bxsrid , status:2},
                "javaClass" : "java.util.HashMap"
              };
              jsonrpc.BH.handle(function(data, ex) {
                if (Bat.outputEx(ex, '计算费用异常'))
                  return;
                 if(typeof data[0]== "string"){
                  Ext.MessageBox.alert("计算结果",data[0]);
                  return;
                 }
                layout.renderDetailByKey('dao.hb.BxSimplerecordPrintBack','id',bxsrid);
              }, 'C', req, 'BXService'); 
            }            
          })}}],
          hide:["hospitalpaytype"]
	  },
	 cfg_prop:{
	 "id":{
		  display:'序号',
		  editor:'DisplayField'
	 },
	 "uid":{
		 display:"用户编号",
		 editor:'DisplayField',
		 hidden:true
	 },
	 "reason":{
		 display:"补充说明",
		 editor:"TextArea",
		 hidden:true,
		 cfg:{
			 width:300,
			 height:50
		 }
	 },
	 "prebxCost":{
		 display:"预报销金额",
		 editor:"DisplayField",
		 hidden:true
	 },
	 "preRemark":{
		 display:"预报销说明",
		 editor:"Display",
		 hidden:true
	 },
	 "bxsrPid":{
		 display:"报销简表编号",
		 editor:'DisplayField',
		 hidden:true
	 },
	 "bxType":{
		  display:"报销类型",
		  editor : 'ComboBox',
		  width:90,
		  dcfg:{
		  allowBlank:false,
		  triggerAction: 'all',
		  listeners: {
					 		'select':{
					 			fn:function( combo, records, eOpts ){
					 				var type=combo.getValue();		
					 				var fm = combo.up('form');
					 				var payAll = fm.query('[name=payAll]');
					 			    if(type=="计划生育"||type==""){
					 				    payAll[0].setReadOnly(true);
					 				    payAll[0].setValue("");
					 				}else{
					 				    payAll[0].setReadOnly(false);
					 				}
					 			}
					 		}
					 	}
		  },
		
		  cfg :BView.func_cfg_combo([['门急诊','门急诊'],['住院','住院'],['计划生育','计划生育'],['大病医疗(器械)','大病医疗(器械)'],['大病医疗(药物)','大病医疗(药物)']])
	 },
	 "topMoney":{
		 display:"超封顶线金额",
		 hidden:false,
		 cfg:{
			 regex:/^(?:[1-9]\d*|0)(?:\.\d+)?$/,   
			 validationEvent:"click",
			 regexText:"只能输入数字"
		 }
	 },
	 "bxCost":{
		 display:"报销金额",
		 editor:"DisplayField"
	 },
	 "remark":{
	   display:"报销说明",
	   editor:"DisplayField"
	 },
	 "payOne":{
		 display:"自付1",
		 cfg:{
			 regex:/^(?:[1-9]\d*|0)(?:\.\d+)?$/,   
			 validationEvent:"click",
			 regexText:"只能输入数字"
		 }
	 },
	 "payTwo":{
		 display:"自付2",
		 cfg:{
			 regex:/^(?:[1-9]\d*|0)(?:\.\d+)?$/,   
			 validationEvent:"click",
			 regexText:"只能输入数字"
		 }
	 },
	 "payAll":{
		 display:"自费",
		 cfg:{
			 regex:/^(?:[1-9]\d*|0)(?:\.\d+)?$/,   
			 validationEvent:"click",
			 regexText:"只能输入数字"
		 }
	 },
	 "dtLook":{
		 display:"看病日期",
		 editor:"DateField",
		 cfg:{
			 allowBlank:false
		 }
	 },
   "dtCreate":{
     display:"创建日期",
     hidden:true,
     editor:"DateField",
	 cfg:{readOnly:true,readOnlyCls:'form_date_readonly'},
     width:150
   },
   "dtModify":{
     display:"修改日期",
     hidden:true,
     editor:"DateField",
	 cfg:{readOnly:true,readOnlyCls:'form_date_readonly'},
     width:150
   }
	 
	 }
	 
 },
 "dao.hb.BxDetailrecord":{
	cn:'报销明细',
 	handles:{'after_put':function(ui){
   	     
   			 var hq="from BxSimplerecord where (status='未提交'  or status='已提交') and uid="+layout.uid;
			  var req = {
	            "map" : {hql:hq },
	            "javaClass" : "java.util.HashMap"
	          };
			 var spid=0;
			 var data = jsonrpc.BH.handle('G',req,'BXService'); 
			 if(data.id)
				 spid=data.id;
			 ui.phql.where="bxsrPid="+spid;
	
    		ui.refreshGrid();
  	},
  	'before_setobj_detail':function(ui,editors,obj){
 		var type=obj.items.map.bxType;
 		if(type=="计划生育"){
 		   editors['payAll'][0].setReadOnly(true);
 		}else{
 		   editors['payAll'][0].setReadOnly(false);
 		}
    }
   },
	 req:{
		 "pss":[["id","uid","bxsrPid","bxType","payOne","payTwo","payAll","topMoney","dtLook","reason","bxCost","remark","prebxCost","preRemark","dtCreate","dtModify"]],
		 "cns":["dao.hb.BxDetailrecord"],
		 "hql":"from BxDetailrecord"
	 },
cfg_detail:{
	btns:["保存","保存下一条"],
	tabs:[{
		title : "基本信息",
		fset : [{
			legend : "",
			props :["bxType","payOne","payTwo","payAll","dtLook"]
		
		},{
		
			legend : "",
			props :["prebxCost","preRemark","dtCreate","dtModify"]
		}]
	}]},
	  cfg_grid:{
      btns : ['录入', '提示删除',{
        text : '预计算报销金额',
        cls : 'x-btn-text-icon',
        icon : 'icons/fam/book.png',
        handler : function(btn) {
            var ui=BView.getUi(btn);
            if(ui.objs.length < 2){
            	return;
            }
            var bxsrid = ui.objs[1].its.bxsrPid;
          Ext.MessageBox.confirm("确认","您确定单据无误并计算报销费用吗？",function(btn){
            if(btn=="no")
              return;
            else {
              var req = {
                "map" : {id : bxsrid , status: 1},
                "javaClass" : "java.util.HashMap"
              };
              jsonrpc.BH.handle(function(data, ex) {
                if (Bat.outputEx(ex, '计算费用异常'))
                  return;
                if(typeof data[0]== "string"){
                  Ext.MessageBox.alert("计算结果",data[0]);
                  return;
                 }
                var hql="from BxDetailrecord where bxsrPid="+ui.objs[1].items.map.bxsrPid;
                //  ui.phql.from=hql;
                  ui.phql.where="bxsrPid="+ui.objs[1].items.map.bxsrPid;
                  Ext.MessageBox.alert("预计报销总额:",data[0]+"元");
                  ui.refreshGrid(true);
         
              }, 'C', req, 'BXService'); 
            }            
          })}},
          {
              text : '提交',
              cls : 'x-btn-text-icon',
              icon : 'icons/connect.png',
              handler : function(btn) {
                var ui=BView.getUi(btn);
                if(ui.objs.length > 1){
                  var id = ui.objs[1].its.id;
                  var uid = ui.objs[1].its.uid;
                var req={"map":{id:id,uid:uid,status:"1"},"javaClass":"java.util.HashMap"};
                 jsonrpc.BH.handle(function(data,ex){
                   if(Bat.outputEx(ex,'提交数据异常')){
                     return;
                   }
                   else if(data){
                       Ext.MessageBox.alert("提交",data[0]);
                       ui.refreshGrid();
                   }

                 },'S',req,'BXService');     
              
                }else{ 
                  Ext.MessageBox.alert("操作提示","当前没有可提交的记录。");
                  return;  
                }
             }}],
          hide:["hospitalpaytype"]
	  },
	 cfg_prop:{
	 "id":{
		  display:'序号',
		  editor:'DisplayField'
	 },
	 "uid":{
		 display:"用户编号",
		 editor:'DisplayField',
		 hidden:true
	 },
	 "reason":{
		 display:"补充说明",
		 editor:"TextArea",
		 hidden:true,
		 cfg:{
			 width:300,
			 height:50
		 }
	 },
	 "prebxCost":{
		 display:"预报销金额",
		 editor:"DisplayField"
	 },
	 "preRemark":{
		 display:"预报销说明",
		 editor:"Display"
	 },
	 "bxsrPid":{
		 display:"报销简表编号",
		 editor:'DisplayField',
		 hidden:true
	 },
	 "payType":{
		 display:"支付类型",
		 editor : 'ComboBox',
		 cfg :BView.func_cfg_combo([['自费','自费'],['自付1','自付1'],['自付2','自付2']]),
		 hidden:true
	 },
	 "bxType":{
		  display:"报销类型",
		  editor : 'ComboBox',
		  width:90,
		  cfg :BView.func_cfg_combo([['门急诊','门急诊'],['住院','住院'],['计划生育','计划生育']]),
		  dcfg:{
		  allowBlank:false,
		  listeners: {
					 		'select':{
					 			fn:function( combo, records, eOpts ){
					 				var type=combo.getValue();		
					 				var fm = combo.up('form');
					 				var payAll = fm.query('[name=payAll]');
					 			    if(type=="计划生育"||type==""){
					 				    payAll[0].setReadOnly(true);
					 				    payAll[0].setValue("");
					 				}else{
					 				    payAll[0].setReadOnly(false);
					 				}
					 			}
					 		}
					 	}
		  }
	 },
	 "topMoney":{
		 display:"超封顶线金额",
		 hidden:true,
		 cfg:{
			 regex:/^(?:[1-9]\d*|0)(?:\.\d+)?$/,   
			 validationEvent:"click",
			 regexText:"只能输入数字"
		 }
	 },
	 "bxCost":{
		 display:"报销金额",
		 editor:"DisplayField",
		 hidden:true
	 },
	 "remark":{
	   display:"报销说明",
	   editor:"DisplayField",
	   hidden:true
	 },
	 "payOne":{
		 display:"自付1",
		 cfg:{
			 regex:/^(?:[1-9]\d*|0)(?:\.\d+)?$/,   
			 validationEvent:"click",
			 regexText:"只能输入数字"
			
		 }
	 },
	 "payTwo":{
		 display:"自付2",
		 cfg:{
			 regex:/^(?:[1-9]\d*|0)(?:\.\d+)?$/,   
			 validationEvent:"click",
			 regexText:"只能输入数字"
		 }
	 },
	 "payAll":{
		 display:"自费",
		 cfg:{
			 regex:/^(?:[1-9]\d*|0)(?:\.\d+)?$/,   
			 validationEvent:"click",
			 regexText:"只能输入数字"
		 }
	 },
	 "dtLook":{
		 display:"看病日期",
		 editor:"DateField",
		 hidden:true,
		 cfg:{
			 allowBlank:false
		 }
	 },
   "dtCreate":{
     display:"创建日期",
     hidden:true,
	 editor:"DateField",
	 cfg:{readOnly:true,readOnlyCls:'form_date_readonly'},
     width:150
   },
   "dtModify":{
     display:"修改日期",
     hidden:false,
	 editor:"DateField",
	 cfg:{readOnly:true,readOnlyCls:'form_date_readonly'},
     width:150
   }
	 
	 }
	 
 },
 "dao.hb.BxDetailrecordWrite":{
	 req:{
		 "pss":[["id","uid","bxsrPid","bxType","payOne","payTwo","payAll","topMoney","dtLook","reason","bxRatio","bxCost","remark","dtCreate","dtModify","oneRadio","twoRadio"]],
		 "cns":["dao.hb.BxDetailrecord"],
		 "hql":"from BxDetailrecord"
	 },
	 cfg_detail:{
			btns:["保存"],
			tabs:[{
				title : "基本信息",
				fset : [{
					legend : "",
					props :["bxType","payOne","oneRadio","payTwo","twoRadio","payAll","bxRatio","dtLook","reason"]
				}
				,{
					legend : "",
					props :["remark","bxCost","dtCreate","dtModify"]
				}]
	 }]},
	  cfg_grid:{
	  	propFilter:["uid","dtLook"],
        btns : [ '录入', '提示删除','检索', '刷新', {
        text : '计算报销金额',
        cls : 'x-btn-text-icon',
        icon : 'icons/fam/book.png',
        handler : function(btn) {
            var ui=BView.getUi(btn);
            var bxsrid = ui.objs[1].its.bxsrPid;
          Ext.MessageBox.confirm("确认","您确定单据无误并计算报销费用吗？",function(btn){
            if(btn=="no")
              return;
            else {
              var req = {
                "map" : {id : bxsrid , status: 2, flg:1},
                "javaClass" : "java.util.HashMap"
              };
              jsonrpc.BH.handle(function(data, ex) {
                if (Bat.outputEx(ex, '计算费用异常'))
                  return;
                if(typeof data[0]== "string"){
                  Ext.MessageBox.alert("计算结果",data[0]);
                  return;
                 }
                ui.refreshGrid();
                layout.renderDetailByKey('dao.hb.BxSimplerecordPrintBack','id',bxsrid);
              }, 'C', req, 'BXService'); 
            }            
          })}}],
          hide:["hospitalpaytype"]
	  },
	 cfg_prop:{
	 "id":{
		  display:'序号',
		  editor:'DisplayField'
	 },
	 "uid":{
		 display:"用户编号",
		 editor:'DisplayField'
	 },
	 "bxRatio":{
		 display:"报销比例  单位%",
		 cfg:{
			 regex:/^(?:[1-9]\d*|0)(?:\.\d+)?$/,   
			 validationEvent:"click",
			 regexText:"只能输入数字"
		 }
	 },
	 "twoRadio":{
		 display:"自付2比例    单位%",
		 cfg:{
			 regex:/^(?:[1-9]\d*|0)(?:\.\d+)?$/,   
			 validationEvent:"click",
			 regexText:"只能输入数字"
		 }
	 },
	 "oneRadio":{
		 display:"自付1比例    单位%",
		 cfg:{
			 regex:/^(?:[1-9]\d*|0)(?:\.\d+)?$/,   
			 validationEvent:"click",
			 regexText:"只能输入数字"
		 }
	 },
	 "reason":{
		 display:"补充说明",
		 editor:"TextArea",
		// hidden:true,
		 cfg:{
			 width:300,
			 height:50
		 }
	 },
	 "bxsrPid":{
		 display:"报销简表编号",
		 editor:'DisplayField',
		 hidden:true
	 },
	 "payType":{
		 display:"支付类型",
		 editor : 'ComboBox',
		 cfg :BView.func_cfg_combo([['自费','自费'],['自付1','自付1'],['自付2','自付2']]),
		 hidden:true
	 },
	 "bxType":{
		  display:"报销类型",
		  editor : 'ComboBox',
		  width:90,
		  dcfg:{
			  allowBlank:false
		  },
		  cfg :BView.func_cfg_combo([['门急诊','门急诊'],['住院','住院'],['计划生育','计划生育'],['大病医疗(器械)','大病医疗(器械)'],['大病医疗(药物)','大病医疗(药物)']])
	 },
	 "topMoney":{
		 display:"超封顶线金额",
		 hidden:true,
		 cfg:{
			 regex:/^(?:[1-9]\d*|0)(?:\.\d+)?$/,   
			 validationEvent:"click",
			 regexText:"只能输入数字"
		 }
	 },
	 "bxCost":{
		 display:"报销金额",
		 editor:"DisplayField"
	 },
	 "remark":{
	   display:"报销说明",
	   editor:"DisplayField"
	 },
	 "payOne":{
		 display:"自付1",
		 cfg:{
			 regex:/^(?:[1-9]\d*|0)(?:\.\d+)?$/,   
			 validationEvent:"click",
			 regexText:"只能输入数字"
		 }
	 },
	 "payTwo":{
		 display:"自付2",
		 cfg:{
			 regex:/^(?:[1-9]\d*|0)(?:\.\d+)?$/,   
			 validationEvent:"click",
			 regexText:"只能输入数字"
		 }
	 },
	 "payAll":{
		 display:"自费",
		 cfg:{
			 regex:/^(?:[1-9]\d*|0)(?:\.\d+)?$/,   
			 validationEvent:"click",
			 regexText:"只能输入数字"
		 }
	 },
	 "dtLook":{
		 display:"看病日期",
		 editor:"DateField",
		 hidden:true,
		 cfg:{
			 allowBlank:false
		 }
	 },
   "dtCreate":{
     display:"创建日期",
     hidden:true,
     editor:"DateField",
	 cfg:{readOnly:true,readOnlyCls:'form_date_readonly'},
     width:150
   },
   "dtModify":{
     display:"修改日期",
     hidden:true,
     editor:"DateField",
	 cfg:{readOnly:true,readOnlyCls:'form_date_readonly'},
     width:150
   }
	 
	 }
	 
 },
 

 "dao.hb.BxUsersimple":{
	 req:{
		 "pss":[["id","uid","PBxsrid","total","bxLimit"],["id","baogf"]],
		 "cns":["dao.hb.BxUsersimple","dao.hb.UUser"],
		 "hql":"from BxUsersimple A , UUser B where A.uid=B.id "
	 },
	 cfg_grid:{
		    selType:'cellmodel',
		    hide: ["B。id"]
		  },
	 cfg_detail:{
			btns:["保存"],
			tabs:[{
				title : "基本信息",
				fset : [{
					legend : "",

					props :["A.id","A.uid","A.PBxsrid","A.total","A.bxLimit","B.baogf"]

				}]
				}]},
	 			
	 cfg_prop:{
	  "A.id":{
		  display:'序号',
		  cfg:{
		  	readOnly:true
		  }
	  },
	  "A.uid":{
		  display:"操作编号"
	  },

	  "A.PBxsrid":{

	    display:"报销简表id"
	  },

	  "A.total":{

		  dispaly:"报销总额"
	  },
	  "A.bxLimit":{
		  display:"报销限额"

	  },
	  "B.baogf":{
		  display:"包干费"
	  },
	  "B.id":{
		  display:"用户编号",
          hidden:true
	  }
	 }
 },
 "dao.hb.BxSimplerecordCheck":{
 	
	 req:{
		 "pss":[["id","uid","uname","recorder","receiptsNum","bxSum","prebxCost","preRemark","reason","remark","newRemark","dtCreate","dtModify","status","dtSubmit","dtCheck"]],
		 "cns":["dao.hb.BxSimplerecord"],
		 "hql":"from BxSimplerecord"
	 },
	 
	cfg_detail:{
		default_active_tab:1,
		btns:["保存","游标"],
		tabs:[{
			title : "基本信息",
			fset : [{
				legend : "",
				props :["id","uid","recorder"]
			},
			{
				legend : "",
				props :["bxSum","receiptsNum","newRemark","dtModify","dtCreate","dtSubmit","dtCheck"]
			}]
			}]},
			
		cfg_grid:{
		  propFilter:["uid","receiptsNum","dtSubmit","dtCheck"],
          btns : ['录入', '提示删除','检索', '刷新'],
        hide: ["status"]
		},
	 cfg_prop:{
	  "id":{
		  display:"序号",
		  editor:'DisplayField'
	  },
	  "uid":{
		display:"申请人",
	    editor:'ComboBox',
	    renderer : function(itxt,r,col,l) {	

			  		var its = r.record?r.record.data:r.item||{};

			  		return  BView.data_tasks_map[its.uid];

		},
	    cfg:{
        	lazyInit:false,
        	emptyText :'请选择',
        	displayField:'name',
        	valueField:'id',
        	triggerAction:'all',
        	typeAhead :true,
        	minChars:1,
        	dcfg:{
   			  allowBlank:false
   		    },
        	listConfig: {
		        getInnerTpl: function() {
		           // return '<div data-qtip="{name}. {pyh}">{name} ({id})</div>';
		        	return '<div data-qtip="{name}. {pyh}">{name}</div>';
		        }
		    },
        	store:{
		        fields: ['id','uid','name','pyh'],
		        proxy: {
		           //异步获取数据，这里的URL可以改为任何动态页面，只要返回JSON数据即可
		            type: 'ajax',
		            url: CFG.app_ctx+'servlet/JSonBaseServlet?hql=select id,userId,name,namePyh from UUser  ',
		            reader: {
		                type: 'array',
		                root: 'list'
		            }
		        },
		        sorters: [{
                    property: 'pyh',
                    direction: 'ASC'
                }],
		        autoLoad: true
		    },
		    listeners: {
		 		'change':{
		 			fn:function(ctl, val,val_old,eOpts){
		 				//console.log(val);
		 			}
		 		}
		 	}
		    
	    }
	  },
	  "reason":{
		  display:"补充说明",
		  editor:"TextArea",
		  hidden:true,
		  cfg:{
				 width:300,
				 height:50
			 }
	  },
	  "newRemark":{
		  display:"报销说明",
		  editor:"DisplayField"
	  },
	  "bxSum":{
		  display:"报销总额",
		  editor:"DisplayField",
		  cfg:{readOnly:true}  
	  },
	  "prebxCost":{
		  display:"预报销总额",
		  hidden:true
	  },
	  "preRemark":{
		  display:"预报销说明",
		  hidden:true
	  },
	  "uname":{
	    display:"报销申请人",
	    hidden:true
	  },
	  "recorder":{
	    display:"录入人",
	    editor:"DisplayField"
	  },
      "dtCreate":{
		 display:"创建日期",
	     hidden:true,
	     editor:"DateField",
		 cfg:{readOnly:true,readOnlyCls:'form_date_readonly'},
	     width:150
	  },
      "remark":{
		  display:"报销说明",
		  editor:"DisplayField",
		  hidden:true
	  },
	  "dtModify":{
		 display:"修改日期",
	     hidden:true,
	     editor:"DateField",
		 cfg:{readOnly:true,readOnlyCls:'form_date_readonly'},
	     width:150
	  },
    "status":{
      hidden: true,
		  display:"状态",
		  editor : 'ComboBox',
		  width:90,
		  dcfg:{
				 allowBlank:false
			 },
			cfg :BView.func_cfg_combo([['审核通过','审核通过'],['审核未通过','审核未通过']])
	  },
	  "receiptsNum":{
		  display:"单据张数",
		  editor :"DisplayField"
	  },
      "dtSubmit":{
		  display:"提交日期",
		  editor:"DateField",
		  cfg:{readOnly:true,readOnlyCls:'form_date_readonly'},
	     hidden:true,
	     width:150
	  },
	  "dtCheck":{
		  display:"审核日期",
		  editor:"DateField",
		  cfg:{readOnly:true,readOnlyCls:'form_date_readonly'},
	      width:150
	  }
	 }
	 ,
   child_views : [{
     title:"明细表",
     vn:"dao.hb.BxDetailrecord",
   func_filter: function(robj, ui) {
     var cn = robj.cns[0];
     var hql = " from BxDetailrecord where bxsrPid=" + (robj.items.map['id'] || 0)+" order by id";    
     ui.setHQL(hql);
   },
   func_setdefault:function(robj,objs){
     objs[0].items.map["bxsrPid"]=robj.items.map['id'];
     objs[0].items.map["uid"]=robj.items.map['uid'];
   }
   }
   
   ]
 },
 "dao.hb.BxSimplerecord":{
	 cn:'报销台账',
	 req:{
		 "pss":[["id","uid","uname","recorder","receiptsNum","bxSum","prebxCost","preRemark","reason","remark","dtCreate","dtModify","status","dtSubmit","dtCheck"]],
		 "cns":["dao.hb.BxSimplerecord"],
		 "hql":"from BxSimplerecord",
		 "close":"true"
	 },
	cfg_detail:{
		btns:["保存","游标"],
		tabs:[{
			title : "基本信息",
			fset : [{
				legend : "",
				props :["id","uid","recorder","reason"]
			},
			{
				legend : "",
				props :["bxSum","receiptsNum","remark","dtModify","dtCreate","dtSubmit","dtCheck"]
			}]
			}]},
		cfg_grid:{
			//selType:'cellmodel',
          btns : ['录入', '提示删除','检索', '刷新'],
        hide: ["status"]
		},
	 cfg_prop:{
	  "id":{
		  display:"序号",
		  editor:'DisplayField'
	  },
	  "uid":{
		  display:"申请人",
	    editor:'ComboBox',
	    cfg:{
        	lazyInit:false,
        	emptyText :'请选择',
        	displayField:'name',
        	valueField:'id',
        	triggerAction:'all',
        	typeAhead :true,
        	minChars:1,
        	listConfig: {
		        getInnerTpl: function() {
		           // return '<div data-qtip="{name}. {pyh}">{name} ({id})</div>';
		        	return '<div data-qtip="{name}. {pyh}">{name}</div>';
		        }
		    },
        	store:{
		        fields: ['id','uid','name','pyh'],
		        proxy: {
		           //异步获取数据，这里的URL可以改为任何动态页面，只要返回JSON数据即可
		            type: 'ajax',
		            url: CFG.app_ctx+'servlet/JSonBaseServlet?hql=select id,userId,name,namePyh from UUser ',
		            reader: {
		                type: 'array',
		                root: 'list'
		            }
		        },
		         sorters: [{
                    property: 'pyh',
                    direction: 'ASC'
                }],
		        autoLoad: true
		    },
		    listeners: {
		 		'change':{
		 			fn:function(ctl, val,val_old,eOpts){
		 				//console.log(val);
		 			//	type:'ajax',
			         //   url: CFG.app_ctx+'servlet/JSonBaseServlet?value='+value+'&=hql=from UUser where name='
			           // var cbo =queryPlan.combo; 
	 				//var ourl=cbo.store.proxy.url;
	 				/**var	baseurl = CFG.app_ctx+"servlet/JSonBaseServlet?hql=";
	 				cbo.store.proxy.url = baseurl+"select A.id,A.name from UUser A,RRel B where A.id=B.id2 and B.entity1='dao.hb.PProject'  and B.entity2='dao.hb.UUser' and B.id1="
	 					+cbo.item['pid']+"  order by B.ord";
	 				cbo.store.load();**/
		 			}
		 		}
		 	}
		    
	    }
	  },
	  "reason":{
		  display:"补充说明",
		  editor:"TextArea",
		  hidden:true,
		  cfg:{
				 width:300,
				 height:50
			 }
	  },
	  "bxSum":{
		  display:"报销总额",
		  editor:"DisplayField",
		  cfg:{readOnly:true}  
	  },
	  "prebxCost":{
		  display:"预报销总额",
		  hidden:true
	  },
	  "preRemark":{
		  display:"预报销说明",
		  hidden:true
	  },
	  "uname":{
	    display:"报销申请人",
	    hidden:true
	  },
	  "recorder":{
	    display:"录入人"
	  },
      "dtCreate":{
		  display:"创建日期",
		  editor :"DisplayField",
		     renderer:function(val){
		    	 if (val){
		    			if(val.time){
		    				var dt = new Date();
		    				dt.setTime(val.time);
		    				dtTime=val;
		    				return Ext.Date.format(dt,'Y-m-d H:i');
		    			}
		    			    var dt = new Date();
		    			    dt.setTime(this.item.dtCreate.time);
		    			    return Ext.Date.format(dt,'Y-m-d H:i');
		    	}
		    	 return "";
		     },	
	     hidden:true,
	     cfg:{readOnly:true},
	     width:150
	  },
      "remark":{
		  display:"报销说明",
		  editor:"DisplayField"
	  },
	  "dtModify":{
		  display:"修改日期",
		  editor :"DisplayField",
		     renderer:function(val){
		    	 if (val){
		    			if(val.time){
		    				var dt = new Date();
		    				dt.setTime(val.time);
		    				return Ext.Date.format(dt,'Y-m-d H:i');
		    			}
		    			    var dt = new Date();
		    			    dt.setTime(this.item.dtModify.time);
		    			    return Ext.Date.format(dt,'Y-m-d H:i');
		    	}
		    	 return "";
		     },	
	     hidden:true,
	     cfg:{readOnly:true},
	     width:150
	  },
    "status":{
      hidden: true,
		  display:"状态",
		  editor : 'ComboBox',
		  width:90,
		  dcfg:{
				 allowBlank:false
			 },
			cfg :BView.func_cfg_combo([['审核通过','审核通过'],['审核未通过','审核未通过']])
	  },
	  "receiptsNum":{
		  display:"单据张数",
		  editor :"DisplayField"
	  },
      "dtSubmit":{
		  display:"提交日期",
		  editor :"DisplayField",
		     renderer:function(val){
		    	 if (val){
		    			if(val.time){
		    				var dt = new Date();
		    				dt.setTime(val.time);
		    				return Ext.Date.format(dt,'Y-m-d H:i');
		    			}
		    			    var dt = new Date();
		    			    dt.setTime(this.item.dtSubmit.time);
		    			    return Ext.Date.format(dt,'Y-m-d H:i');
		    	}
		    	 return "";
		     },	
	     hidden:true,
	     width:150
	  },
	  "dtCheck":{
		  display:"审核日期",
		  editor :"DisplayField",
		     renderer:function(val){
		    	 if (val){
		    			if(val.time){
		    				var dt = new Date();
		    				dt.setTime(val.time);
		    				return Ext.Date.format(dt,'Y-m-d H:i');
		    			}
		    			    var dt = new Date();
		    			    dt.setTime(this.item.dtCheck.time);
		    			    return Ext.Date.format(dt,'Y-m-d H:i');
		    	}
		    	 return "";
		     },	
	     width:150
	  }
	 }
	 ,
   child_views : [{
     title:"明细表",
     vn:"dao.hb.BxDetailrecord",
   func_filter: function(robj, ui) {
     var cn = robj.cns[0];
     var hql = " from BxDetailrecord where bxsrPid=" + (robj.items.map['id'] || 0)+" order by id";    
     ui.setHQL(hql);
   },
   func_setdefault:function(robj,objs){
     objs[0].items.map["bxsrPid"]=robj.items.map['id'];
     objs[0].items.map["uid"]=robj.items.map['uid'];
   }
   }
   
   ]
 },
 "dao.hb.BxSimplerecordWrite":{
	 req:{
		 "pss":[["id","uid","uname","recorder","receiptsNum","bxSum","prebxCost","preRemark","reason","remark","dtCreate","dtModify","status","dtSubmit","dtCheck","diff"]],
		 "cns":["dao.hb.BxSimplerecord"],
		 "hql":"from BxSimplerecord ",
		 "close":"true",
		 "specil":"true"
	 },
	cfg_detail:{
		default_active_tab:1,
		btns:["保存","游标"],
		tabs:[{
			title : "基本信息",
			fset : [{
				legend : "",
				props :["id","uid","recorder","reason"]
			},
			{
				legend : "",
				props :["bxSum","receiptsNum","remark","dtModify","dtCreate","dtSubmit","dtCheck"]
			}]
			}]},
	cfg_grid:{
      btns : ['录入', '提示删除',  '检索', '刷新'],
      propFilter:["uid","receiptsNum","dtSubmit","dtCheck"],
      hide: ["status"]
	},
	 cfg_prop:{
	  "id":{
		  display:"序号",
		  editor:'DisplayField'
	  },
	  "uid":{
		display:"申请人",
	    editor:'ComboBox',
	    renderer : function(itxt,r,col,l) {	
	  		var its = r.record?r.record.data:r.item||{};
	  		return  BView.data_tasks_map[its.uid];
		},
	    cfg:{
        	lazyInit:false,
        	emptyText :'请选择',
        	displayField:'name',
        	valueField:'id',
        	triggerAction:'all',
        	typeAhead :true,
        	 dcfg:{
   			  allowBlank:false
   		  },
        	minChars:1,
        	listConfig: {
		        getInnerTpl: function() {
		           // return '<div data-qtip="{name}. {pyh}">{name} ({id})</div>';
		        	return '<div data-qtip="{name}. {pyh}">{name}</div>';
		        }
		    },
        	store:{
		        fields: ['id','uid','name','pyh'],
		        proxy: {
		           //异步获取数据，这里的URL可以改为任何动态页面，只要返回JSON数据即可
		            type: 'ajax',
		            url: CFG.app_ctx+'servlet/JSonBaseServlet?hql=select id,userId,name,namePyh from UUser ',
		            reader: {
		                type: 'array',
		                root: 'list'
		            }
		        },
		         sorters: [{
                    property: 'pyh',
                    direction: 'ASC'
                }],
		        autoLoad: true
		    },
		    listeners: {
		 		'change':{
		 			fn:function(ctl, val,val_old,eOpts){
		 				//console.log(val);
		 			}
		 		}
		 	}
		    
	    }
	  },
	 "diff":{
		 hidden:true,
		 display:"特殊报销"
	 },
	  "reason":{
		  display:"补充说明",
		  editor:"TextArea",
		  hidden:true,
		  cfg:{
				 width:300,
				 height:50
			 }
	  },
	  "bxSum":{
		  display:"报销总额",
		  editor:"DisplayField",
		  cfg:{readOnly:true}  
	  },
	  "prebxCost":{
		  display:"预报销总额",
		  hidden:true
	  },
	  "preRemark":{
		  display:"预报销说明",
		  hidden:true
	  },
	  "uname":{
	    display:"报销申请人",
	    hidden:true
	  },
	  "recorder":{
	    display:"录入人",
	    editor:"DisplayField"
	  },
      "dtCreate":{
		 display:"创建日期",
	     hidden:true,
	     editor:"DateField",
		 cfg:{readOnly:true,readOnlyCls:'form_date_readonly'},
	     width:150
	  },
      "remark":{
		  display:"报销说明",
		  editor:"DisplayField"
	  },
	  "dtModify":{
		 display:"修改日期",
	     hidden:true,
	     editor:"DateField",
		 cfg:{readOnly:true,readOnlyCls:'form_date_readonly'},
	     width:150
	  },
    "status":{
      hidden: true,
		  display:"状态",
		  editor : 'ComboBox',
		  width:90,
		  dcfg:{
				 allowBlank:false
			 },
			cfg :BView.func_cfg_combo([['审核通过','审核通过'],['审核未通过','审核未通过']])
	  },
	  "receiptsNum":{
		  display:"单据张数",
		  editor :"DisplayField"
	  },
      "dtSubmit":{
		  display:"提交日期",
		  editor:"DateField",
		  cfg:{readOnly:true,readOnlyCls:'form_date_readonly'},
	      hidden:true,
	      width:150
	  },
	  "dtCheck":{
		 display:"审核日期",
		 editor:"DateField",
		 cfg:{readOnly:true,readOnlyCls:'form_date_readonly'},
	     width:150
	     
	  }
	 }
	 ,
   child_views : [{
     title:"明细表",
     vn:"dao.hb.BxDetailrecordWrite",
   func_filter: function(robj, ui) {
     var cn = robj.cns[0];
     var hql = " from BxDetailrecord where bxsrPid=" + (robj.items.map['id'] || 0)+" order by id";    
     ui.setHQL(hql);
   },
   func_setdefault:function(robj,objs){
     objs[0].items.map["bxsrPid"]=robj.items.map['id'];
     objs[0].items.map["uid"]=robj.items.map['uid'];
   }
   }
   
   ]
	 ,
	   func_setdefault:function(robj,objs){
		     objs[0].items.map["diff"]="true";
		   }
 },

 "dao.hb.BxDetailrecordRead":{
	 req:{
		 "pss":[["id","uid","bxsrPid","bxType","payOne","payTwo","payAll","topMoney","dtLook","bxCost","reason","remark","dtCreate","dtModify"]],
		 "cns":["dao.hb.BxDetailrecord"],
		 "hql":"from BxDetailrecord"
	 },
	
	 cfg_grid:{
          btns : [ ],
          hide:["hospitalpaytype"],
          propFilter:["uid","dtLook"]
	 },
	 cfg_prop:{
	 "id":{
		  display:'序号',
		  editor :"DisplayField",
		  cfg:{
		  	readOnly:true
		  }
	 },
	 "reason":{
		 display:"补充说明",
		 editor:"DisplayField",
		 hidden:true
	 },
	 "uid":{
		 display:"用户编号",
		 hidden:true,
		 editor :"DisplayField"
	 },
	 "bxsrPid":{
		 display:"报销登记编号",
		 editor :"DisplayField",
		 hidden:true
	 },
	 "bxType":{
		  display:"报销类型",
		  editor :"DisplayField",
		  width:90
	 },
	 "topMoney":{
		 display:"超封顶线金额",
		 editor :"DisplayField",
		 hidden:true
	 },
	 "bxCost":{
		 display:"报销金额",
		 editor :"DisplayField"
	 },
	 "remark":{
	   display:"报销说明",
	   editor :"DisplayField"
	 },
	 "payOne":{
		 display:"自付1",
		 editor :"DisplayField"
	 },
	 "payTwo":{
		 display:"自付2",
		 editor :"DisplayField"
	 },
	 "payAll":{
		 display:"自费",
		 editor :"DisplayField"
	 },
	 "dtLook":{
		 display:"看病日期",
		 editor:"DateField",
		 cfg:{readOnly:true,readOnlyCls:'form_date_readonly'}
	 },
   "dtCreate":{
     display:"创建日期",
     editor:"DateField",
	 cfg:{readOnly:true,readOnlyCls:'form_date_readonly'},
     hidden:true,
     width:150
   },
   "dtModify":{
     display:"修改日期",
     editor:"DateField",
	 cfg:{readOnly:true,readOnlyCls:'form_date_readonly'},
     hidden:true,
     width:150
   }
	 },
	 cfg_detail:{
		 btns:["游标"],
			tabs:[{
				title : "基本信息",
				fset : [{
					legend : "",
					props :["id","uid","bxsrPid","bxType","payOne","payTwo","payAll"]
				},{
					legend : "",
					props :["bxCost","remark","reason","dtLook","dtCreate","dtModify"]
				}]
	 }]}
 },
 "dao.hb.BxDetailrecordReadA":{
	 req:{
		 "pss":[["id","uid","bxsrPid","bxType","payOne","payTwo","payAll","topMoney","dtLook","prebxCost","preRemark","reason","bxCost","remark","dtCreate","dtModify"]],
		 "cns":["dao.hb.BxDetailrecord"],
		 "hql":"from BxDetailrecord"
	 },
	  cfg_grid:{
         btns : []
	  },
	 cfg_prop:{
	 "id":{
		  display:'序号',
		  editor :"DisplayField",
		  cfg:{
		  	readOnly:true
		  }
	 },
	 "uid":{
		 display:"用户编号",
		 editor :"DisplayField",
		 hidden:true		 
	 },
	 "bxsrPid":{
		 display:"报销登记编号",
		 editor :"DisplayField",
		 hidden:true
	 },
	 "reason":{
		 display:"补充说明",
		 hidden:true
	 },
	 "bxType":{
		  display:"报销类型",
		  editor :"DisplayField",
		  width:90
	 },
	 "topMoney":{
		 display:"超封顶线金额",
		 editor :"DisplayField",
		 hidden:true
	 },
	 "bxCost":{
		 display:"报销金额",
		 editor :"DisplayField"
	 },
	 "prebxCost":{
		 display:'预报销金额',
		 editor:'DisplayField',
		 hidden:true
	 },
	 "preRemark":{
		 display:'预报销说明',
		 editor:'DisplayField'
	 },
	 "remark":{
	   display:"报销说明",
	   editor :"DisplayField"
	 },
	 "payOne":{
		 display:"自付1",
		 editor :"DisplayField"
	 },
	 "payTwo":{
		 display:"自付2",
		 editor :"DisplayField"
	 },
	 "payAll":{
		 display:"自费",
		 editor :"DisplayField"
	 },
	 "dtLook":{
		 display:"看病日期",
		 editor:"DateField",
		 cfg:{readOnly:true,readOnlyCls:'form_date_readonly'}
	 },
   "dtCreate":{
     display:"创建日期",
     hidden:true,
     editor:"DateField",
	 cfg:{readOnly:true,readOnlyCls:'form_date_readonly'},
     width:150
   },
   "dtModify":{
     display:"修改日期",
     editor:"DateField",
	 cfg:{readOnly:true,readOnlyCls:'form_date_readonly'},
     hidden:true,
     width:150
   }
	 },
	 cfg_detail:{
		 btns:["游标"],
			tabs:[{
				title : "基本信息",
				fset : [{
					legend : "",
					props :["id","bxsrPid","bxType","payOne","payTwo","payAll"]
				},{
					legend : "",
					props :["bxCost","remark","prebxCost","preRemark","dtLook","dtCreate","dtModify"]
				}]
	 }]}
 },
 "dao.hb.BxMidle":{
	 cn:'已报明细',
	 req:{
		 "pss":[["id","did","name","uid","bxSid","bxtype","payone","paytwo","payall","remark","bxDate","bxSum"]],
		 "cns":["dao.hb.BxMidle"],
		 "hql":"from BxMidle"
	 },

	  cfg_detail:{
			tabs:[{
				title : "基本信息",
				fset : [{
					legend : "",
					props :["did","name","uid","bxSid","bxtype","payone","paytwo","payall","remark","bxSum","bxDate"]
				}]
	 }]},

	  cfg_grid:{
         btns : ['日期',{
	      text:  '报表统计',
	      cls: 'x-btn-text-icon',
	      icon : 'icons/chart_pie.png',
	      menu : new Ext.menu.Menu({
          items : [{
             	  text:"全院统计",
    	          scope : this,
    	          handler : function(btn,item){
    	        	  var ui=BView.getUi(btn);
    	              var firstDate = ui.firstDate.getValue();
    	              var secondDate = ui.secondDate.getValue();
    	              if (firstDate==null || secondDate==null){     
    	                Ext.MessageBox.alert("操作提示","请选择待统计记录的看病日期起始时间段。");
                      return; 
    	              }else{
    	               
    	                  var dt = new Date();
    	                  dt.setTime(firstDate);
    	                  firstDate = Ext.Date.format(dt,'Y-m-d');
    	                  dt.setTime(secondDate);
    	                  secondDate = Ext.Date.format(dt,'Y-m-d');
    	                   if(firstDate>secondDate){             
                           var a = secondDate;
                           secondDate = firstDate;
                           firstDate = a;                        
                         }
                    Ext.MessageBox.confirm("确认","是否导出全部人员的统计信息？", function(btn){               
                      if(btn=="no")
                        return;
                       var baseURL =CFG.app_ctx+"servlet/StactisticHandler?"; 
                       var url = baseURL+"&type=I&start="+firstDate+"&end="+secondDate;
                       window.open(url,'_blank');
                        
                     });
                  }}
                 
               },{
            	  text:"部门统计",
    	          scope : this,
    	          handler : function(btn,item){
    	        	  var ui=BView.getUi(btn);
    	              var firstDate = ui.firstDate.getValue();
    	              var secondDate = ui.secondDate.getValue();
    	              if (firstDate==null || secondDate==null){     
    	                Ext.MessageBox.alert("操作提示","请选择待统计记录的看病日期起始时间段。");
                      return; 
    	              }else{
    	               
    	                  var dt = new Date();
    	                  dt.setTime(firstDate);
    	                  firstDate = Ext.Date.format(dt,'Y-m-d');
    	                  dt.setTime(secondDate);
    	                  secondDate = Ext.Date.format(dt,'Y-m-d');
    	                   if(firstDate>secondDate){             
                           var a = secondDate;
                           secondDate = firstDate;
                           firstDate = a;                        
                         }
                    Ext.MessageBox.confirm("确认","是否导出部门汇总统计信息？", function(btn){               
                      if(btn=="no")
                        return;
                       var baseURL =CFG.app_ctx+"servlet/StactisticHandler?"; 
                       var url = baseURL+"&type=D&start="+firstDate+"&end="+secondDate;
                       window.open(url,'_blank');
                        
                     });
                  }}
                 
               },{
            	  text:"年龄段统计",
            	  scope : this,
                  handler : function(btn,item){
                	var ui=BView.getUi(btn);
                    var firstDate = ui.firstDate.getValue();
                    var secondDate = ui.secondDate.getValue();
                    if (firstDate==null || secondDate==null){     
                      Ext.MessageBox.alert("操作提示","请选择待统计记录的看病日期起始时间段。");
                      return; 
                    }else{
                        var dt = new Date();
                        dt.setTime(firstDate);
                        firstDate = Ext.Date.format(dt,'Y-m-d');
                        dt.setTime(secondDate);
                        secondDate = Ext.Date.format(dt,'Y-m-d');
                        if(firstDate>secondDate){              
                          var a = secondDate;
                          secondDate = firstDate;
                          firstDate = a;                        
                        }
                    Ext.MessageBox.confirm("确认","是否按照年龄段导出统计信息？", function(btn){               
                      if(btn=="no")
                        return;
                       var baseURL =CFG.app_ctx+"servlet/StactisticHandler?"; 
                       var url = baseURL+"&type=A&start="+firstDate+"&end="+secondDate;
                       window.open(url,'_blank');
                        
                     });
    		          }}
    	             
    	       },{
            	  text:"按月统计",
            	  scope : this,
                  handler : function(btn,item){
                	var ui=BView.getUi(btn);
                    var firstDate = ui.firstDate.getValue();
                    var secondDate = ui.secondDate.getValue();
                    if (firstDate==null || secondDate==null){     
                      Ext.MessageBox.alert("操作提示","请选择待统计记录的看病日期起始时间段。");
                      return; 
                    }else{
                        var dt = new Date();
                        dt.setTime(firstDate);
                        firstDate = Ext.Date.format(dt,'Y-m-d');
                        dt.setTime(secondDate);
                        secondDate = Ext.Date.format(dt,'Y-m-d');
                        if(firstDate>secondDate){              
                          var a = secondDate;
                          secondDate = firstDate;
                          firstDate = a;                        
                        }
                    Ext.MessageBox.confirm("确认","是否按照月份导出统计信息？", function(btn){               
                      if(btn=="no")
                        return;
                       var baseURL =CFG.app_ctx+"servlet/StactisticHandler?"; 
                       var url = baseURL+"&type=M&start="+firstDate+"&end="+secondDate;
                       window.open(url,'_blank');
                        
                     });
    		          }}
    		             
    		       },{ 
            	  text:"计划生育",
            	  scope : this,
                  handler : function(btn,item){
                	 var ui=BView.getUi(btn);
                    var firstDate = ui.firstDate.getValue();
                    var secondDate = ui.secondDate.getValue();
                    if (firstDate==null || secondDate==null){     
                      Ext.MessageBox.alert("操作提示","请选择待统计记录的看病日期起始时间段。");
                      return; 
                    }else{
                        var dt = new Date();
                        dt.setTime(firstDate);
                        firstDate = Ext.Date.format(dt,'Y-m-d');
                        dt.setTime(secondDate);
                        secondDate = Ext.Date.format(dt,'Y-m-d');
                        if(firstDate>secondDate){              
                          var a = secondDate;
                          secondDate = firstDate;
                          firstDate = a;                        
                        }
                    var baseURL =CFG.app_ctx+"servlet/StactisticHandler?"; 
                    var url = baseURL+"&type=J&start="+firstDate+"&end="+secondDate;
                    window.open(url,'_blank');
    	        	  
    	         }}
    	             
    	       },{  
            	  text:"大病(药物)",
            	  scope : this,
                  handler : function(btn,item){
                	  var ui=BView.getUi(btn);
                    var firstDate = ui.firstDate.getValue();
                    var secondDate = ui.secondDate.getValue();
                    if (firstDate==null || secondDate==null){     
                      Ext.MessageBox.alert("操作提示","请选择待统计记录的看病日期起始时间段。");
                      return; 
                    }else{
                        var dt = new Date();
                        dt.setTime(firstDate);
                        firstDate = Ext.Date.format(dt,'Y-m-d');
                        dt.setTime(secondDate);
                        secondDate = Ext.Date.format(dt,'Y-m-d');
                        if(firstDate>secondDate){              
                          var a = secondDate;
                          secondDate = firstDate;
                          firstDate = a;                        
                        }
                      var baseURL =CFG.app_ctx+"servlet/StactisticHandler?"; 
                      var url = baseURL+"&type=Y&start="+firstDate+"&end="+secondDate;
                      window.open(url,'_blank');     
                      }}
    		             
    		   },{  
            	  text:"大病(器械)",
            	  scope : this,
                 handler : function(btn,item){
                	 var ui=BView.getUi(btn);
                   var firstDate = ui.firstDate.getValue();
                   var secondDate = ui.secondDate.getValue();
                   if (firstDate==null || secondDate==null){     
                     Ext.MessageBox.alert("操作提示","请选择待统计记录的看病日期起始时间段。");
                     return; 
                   }else{
                       var dt = new Date();
                       dt.setTime(firstDate);
                       firstDate = Ext.Date.format(dt,'Y-m-d');
                       dt.setTime(secondDate);
                       secondDate = Ext.Date.format(dt,'Y-m-d');
                       if(firstDate>secondDate){             
                         var a = secondDate;
                         secondDate = firstDate;
                         firstDate = a;                        
                       }
                   var baseURL =CFG.app_ctx+"servlet/StactisticHandler?"; 
                   var url = baseURL+"&type=Q&start="+firstDate+"&end="+secondDate;
                   window.open(url,'_blank');    
    	        	  
    	          }}    
           }]
              
    	      })

    	    }]
    	  },
	 cfg_prop:{
	 "id":{
		  display:'序号',
		  editor :"DisplayField",
          hidden:true,
		  cfg:{
		  	readOnly:true
		  }
	 },
	 "did":{
	 	 editor :"DisplayField",
	     display:"编号"
	 },
     "did":{
         editor :"DisplayField",
         display:"编号"
     },
	 "name":{
		 display:"用户名",
		 editor:"DisplayField"
	 },
	 "uid":{
		 display:"用户编号",
		 editor :"DisplayField",
		 hidden:true
	 },
	 "bxSid":{
		 display:"报销登记编号",
		 editor :"DisplayField",
		 hidden:true
	 },
	 "bxtype":{
		  display:"报销类型",
		  editor :"DisplayField",
		  width:90
	 },
	 "remark":{
	   display:"报销说明",
	   editor :"DisplayField",
	   hidden:true
	 },
	 "payone":{
		 display:"自付1",
		 editor :"DisplayField"
	 },
	 "paytwo":{
		 display:"自付2",
		 editor :"DisplayField"
	 },
	 "payall":{
		 display:"自费",
		 editor :"DisplayField"
	 },
	 "bxSum":{
		 display:"报销总额",
		 editor:"DisplayField"
	 },
   "bxDate":{
     display:"创建日期",
     hidden:true,
     editor:"DateField",
	 cfg:{readOnly:true,readOnlyCls:'form_date_readonly'},
     width:150
   }
	 }
 },
 "dao.hb.VBxmidle":{
	 req:{
		 "pss":[["id","uid","bxtype","payone","paytwo","payall","bxSum"]],
		 "cns":["dao.hb.VBxmidle"],
		 "hql":"from VBxmidle",
		 "close":"true"
	 },
	  cfg_grid:{
         btns : []
	  },
	 cfg_prop:{
	 "id":{
		  display:'序号',
		  editor :"DisplayField",
		  hidden:true,
		  cfg:{
		  	readOnly:true
		  }
	 },
	 "uid":{
		 display:"用户编号",
		 editor :"DisplayField",
		 hidden:true
	 },
	 "bxtype":{
		  display:"报销类型",
		  editor :"DisplayField",
		  width:90
	 },
	 "payone":{
		 display:"自付1合计",
		 editor :"DisplayField"
	 },
	 "paytwo":{
		 display:"自付2合计",
		 editor :"DisplayField"
	 },
	 "payall":{
		 display:"自费合计",
		 editor :"DisplayField",
		 cfg:{
			 readOnly:true,
			 readOnlyCls:'form_color_readonly',
		     tdCls: 'alarm'
		    }
},
	 "bxSum":{
		 display:"报销总额合计",
		 editor:"DisplayField"
	 }
	 }
 },
 "dao.hb.BxSimplerecordRead":{
	 req:{
		 "pss":[["id","uid","uname","recorder","receiptsNum","bxSum","prebxCost","preRemark","reason","newRemark","remark","dtCreate","dtModify","status","dtSubmit","dtCheck"]],
		 "cns":["dao.hb.BxSimplerecord"],
		 "hql":" from  BxSimplerecord "
	 },
	cfg_detail:{
		btns:["游标",{
		      text : '打印',
		      cls : 'x-btn-text-icon',
		      icon : 'icons/email_link.png',
		      handler : function(btn) {
		         var divId=this.tabDetail.id+'-body';
		         var panel=document.getElementById(divId);  
		         var newstr = panel.innerHTML;  
		         BView.print(newstr);
		      }
		    }],
		tabs:[{
			title : "基本信息",
			fset : [{
				legend : "",
				props :["id","uname","recorder","status","receiptsNum","bxSum"]
			},{
				legend : "",
				props :["newRemark","reason"]
			},{
				legend : "",
				props :["dtModify","dtCreate","dtSubmit","dtCheck"]
			}]
			}
		
		]},
	cfg_grid:{
	  propFilter:["uid","receiptsNum","dtSubmit","dtCheck"],
      btns : ['检索', '刷新',{
      	    text : '删除',
			cls : 'x-btn-text-icon',
			icon : '../bat/icons/delete.png',
			handler : function(btn) {
				var ui=BView.getUi(btn);
				var sels = BView.getSels(btn)
				if (!sels || sels.length == 0){
				  Ext.MessageBox.show({
			           title: '系统提示',
			           msg: '请先选中要删除的记录',
			           buttons: Ext.MessageBox.OK,
			           icon: Ext.MessageBox.INFO
		          });
					return;
				}else if (sels.length >1){
				  Ext.MessageBox.show({
			           title: '系统提示',
			           msg: '请选择一条记录进行删除',
			           buttons: Ext.MessageBox.OK,
			           icon: Ext.MessageBox.INFO
		          });
					return;
				}

					Ext.MessageBox.confirm("确认","是否确认删除选中的["+sels.length+"]条数据",function(btn){
					     if(btn=="no"){
					        return;
					     }
					 	for (var i = 0; i < sels.length; i++) {
							var o = sels[i].obj;
								o.action = "R";
					  }
					ui.reload = false;
					ui.ds.load();
					ui.save();
	    		 		 
					});
			}
		}
      ],
      hide: ["status"]
	},
	 cfg_prop:{
	  "id":{
		  display:"序号",
		  editor :"DisplayField",
		  hidden:true
	  },
	  "uid":{
		  display:"申请人",
		  editor:'ComboBox',
		  hidden:true,
	    cfg:{
        	lazyInit:false,
        	emptyText :'请选择',
        	displayField:'name',
        	valueField:'id',
        	triggerAction:'all',
        	typeAhead :true,
        	 dcfg:{
   			  allowBlank:false
   		  },
        	minChars:1,
        	listConfig: {
		        getInnerTpl: function() {
		           // return '<div data-qtip="{name}. {pyh}">{name} ({id})</div>';
		        	return '<div data-qtip="{name}. {pyh}">{name}</div>';
		        }
		    },
        	store:{
		        fields: ['id','uid','name','pyh'],
		        proxy: {
		           //异步获取数据，这里的URL可以改为任何动态页面，只要返回JSON数据即可
		            type: 'ajax',
		            url: CFG.app_ctx+'servlet/JSonBaseServlet?hql=select id,userId,name,namePyh from UUser ',
		            reader: {
		                type: 'array',
		                root: 'list'
		            }
		        },
		         sorters: [{
                    property: 'pyh',
                    direction: 'ASC'
                }],
		        autoLoad: true
		    },
		    listeners: {
		 		'change':{
		 			fn:function(ctl, val,val_old,eOpts){
		 				//console.log(val);
		 			}
		 		}
		 	}
		    
	    }
	  },
	  "reason":{
		  display:"补充说明",
		  editor:"DisplayField",
		  
		  hidden:true
	  },
	  "bxSum":{
		  display:"报销总额",
		  editor :"DisplayField"  
	  },
	  "prebxCost":{
		  display:"预报销总额",
		  hidden:true,
		  editor :"DisplayField"
	  },
	  "preRemark":{
		  display:"预报销说明",
		  hidden:true,
		  editor:"DisplayField"
	  },
	  "uname":{
	    display:"申请人",
	    editor :"DisplayField"
	  },
	  "recorder":{
	    display:"录入人",
	    editor :"DisplayField"
	  },
      "remark":{
		  display:"报销说明",
		  editor :"DisplayField",
		  hidden:true
	  },
      "newRemark":{
		  display:"报销说明",
		  editor :"DisplayField",
		  hidden:true
	  },
	  "preRemark":{
		  display:"预报销说明",
		  editor :"DisplayField",
		  hidden:true,
		  height:300,
		  width:300
	  },
     "status":{
          hidden: true,
		  display:"报销状态",
		  editor :"DisplayField",
		  cfg:{readOnly:true}  
	  },
	  "receiptsNum":{
		  display:"单据张数",
		  editor :"DisplayField"
	  },
     "dtCreate":{
		  display:"创建日期",
		  editor :"DisplayField",
		  renderer:function (val) {
			  if(val=="")
				   return "";
				if (val){					
					if(typeof val=='string'){
						val=this.item["dtCreate"];
					}
						var dt = new Date();
	    			    dt.setTime(val);
						return Ext.Date.format(dt,'Y-m-d');
				}
			  },
	     hidden:true,
	     width:150
	  },
	  "dtModify":{
		  display:"修改日期",
		  editor :"DisplayField",
		  renderer:function (val) {
			  if(val=="")
				   return "";
				if (val){			
					if(typeof val=='string'){
						val=this.item["dtModify"];
					}
						var dt = new Date();
	    			    dt.setTime(val);
						return Ext.Date.format(dt,'Y-m-d');
				}
			  },
	      hidden:true,
	      width:150
	  },
     "dtSubmit":{
		  display:"提交日期",
		  editor :"DisplayField",
		  renderer:function (val) {
			  if(val=="")
				   return "";
				if (val){					
					if(typeof val=='string'){
						val=this.item["dtSubmit"];
					}
						var dt = new Date();
	    			    dt.setTime(val);
						return Ext.Date.format(dt,'Y-m-d');
				}
			  },
	      hidden:true,
	      width:150
	  },
	  "dtCheck":{
		  display:"审核日期",
	      editor :"DisplayField",
		  renderer:function (val) {
			  if(val=="")
				   return "";
				if (val){					
					if(typeof val=='string'){
						val=this.item["dtCheck"];
					}
						var dt = new Date();
	    			    dt.setTime(val);
						return Ext.Date.format(dt,'Y-m-d');
				}
			  },
	      width:150
	  }
	 },
   child_views : [{
     title:"明细表",
     vn:"dao.hb.BxDetailrecordRead",
   func_filter: function(robj, ui) {
     var cn = robj.cns[0];
     var hql = " from BxDetailrecord where bxsrPid=" + (robj.items.map['id'] || 0)+" order by id";    
     ui.setHQL(hql);
   },
   func_setdefault:function(robj,objs){
     objs[0].items.map["bxsrPid"]=robj.items.map['id'];
     objs[0].items.map["uid"]=robj.items.map['uid'];
   }
   }]
 },
  "dao.hb.BxSimplerecordPrintBack":{
	funcs:{ 
		"func_return":function(ap){ 
			  layout.selectNode("itr_9","审核或录入");
		} 
	}, 
	 req:{
		 "pss":[["id","uid","uname","recorder","receiptsNum","bxSum","prebxCost","preRemark","reason","newRemark","remark","dtCreate","dtModify","status","dtSubmit","dtCheck"],["id","name"]],
		 "cns":["dao.hb.BxSimplerecord","dao.hb.UUser"],
		 "hql":"from BxSimplerecord A , UUser B where A.uid=B.id",
		 "close":"true"
	 },
	cfg_detail:{
		btns:["游标",{
		      text : '打印',
		      cls : 'x-btn-text-icon',
		      icon : 'icons/email_link.png',
		      handler : function(btn) {
		        var divId=this.tabDetail.id+'-body';
		        var panel=document.getElementById(divId);  
		         var newstr = panel.innerHTML;  
		         BView.print(newstr);
		      }
		    }],
		tabs:[{
			title : "基本信息",
			fset : [{
				legend : "",
				props :["A.id","B.name","A.recorder","A.status","A.receiptsNum","A.bxSum"]
			},{
				legend : "",
				props :["A.newRemark","A.reason"]
			},{
				legend : "",
				props :["A.dtModify","A.dtCreate","A.dtSubmit","A.dtCheck"]
			}]
			}
		
		]},
	cfg_grid:{
		
      btns : ['检索', '刷新'],
      hide: ["A.status"]
	},
	 cfg_prop:{
	  "A.id":{
		  display:"序号",
		  editor :"DisplayField"
	  },
	  "A.uid":{
		  display:"申请人",
		  editor :"DisplayField",
		  hidden:true
	  },
	  "A.reason":{
		  display:"补充说明",
		  editor:"DisplayField",
		  
		  hidden:true
	  },
	  "B.name":{
		  display:"姓名",
		  editor:"DisplayField",
		  width:100
	  },
	  "A.newRemark":{
		  display:"报销说明",
		  editor:"DisplayField"
	  },
	  "B.id":{
		  display:"用户编号",
		  editor:"DisplayField",
		  hidden:true
	  },
	  "A.bxSum":{
		  display:"报销总额",
		  editor :"DisplayField"  
	  },
	  "A.prebxCost":{
		  display:"预报销总额",
		  hidden:true,
		  editor :"DisplayField"
	  },
	  "A.preRemark":{
		  display:"预报销说明",
		  hidden:true,
		  editor:"DisplayField"
	  },
	  "A.uname":{
	    display:"报销申请人",
	    editor :"DisplayField",
	    hidden:true
	    
	  },
	  "A.recorder":{
	    display:"录入人",
	    editor :"DisplayField"
	  },
 
      "A.remark":{
		  display:"报销说明",
		  editor :"DisplayField",
		  hidden:true
	  },
	  "A.preRemark":{
		  display:"预报销说明",
		  editor :"DisplayField",
		  hidden:true,
		  height:300,
		  width:300
	  },
	 
     "A.status":{
          hidden: true,
		  display:"报销状态",
		  editor :"DisplayField",
		  cfg:{readOnly:true}  
	  },
	  "A.receiptsNum":{
		  display:"单据张数",
		  editor :"DisplayField"
	  },
	  "A.dtCreate":{
			  display:"创建日期",
			  editor :"DisplayField",
			  serchDate:true,
			  renderer:function (val) {
				  if(val=="")
					   return "";
					if (val){					
						if(typeof val=='string'){
							val=this.item["A.dtCreate"];
						}
							var dt = new Date();
		    			    dt.setTime(val);
							return Ext.Date.format(dt,'Y-m-d H:i');
					}
				  },
		     cfg:{readOnly:true,readOnlyCls:'form_date_readonly'},
		     hidden:true,
		     width:150
		  },
	  "A.dtModify":{
		  display:"修改日期",
		  editor :"DisplayField",
		  renderer:function (val) {
			  if(val=="")
				   return "";
				if (val){			
					if(typeof val=='string'){
						val=this.item["A.dtModify"];
					}
						var dt = new Date();
	    			    dt.setTime(val);
						return Ext.Date.format(dt,'Y-m-d H:i');
				}
			  },      
	      hidden:true,
	      width:150
	  },
      "A.dtSubmit":{
		  display:"提交日期",
		  editor :"DisplayField",
		  renderer:function (val) {
			  if(val=="")
				   return "";
				if (val){					
					if(typeof val=='string'){
						val=this.item["A.dtSubmit"];
					}
						var dt = new Date();
	    			    dt.setTime(val);
						return Ext.Date.format(dt,'Y-m-d H:i');
				}
			  },
	      cfg:{readOnly:true},
	      hidden:true,
	      width:150
	  },
	  "A.dtCheck":{
		  display:"审核日期",
		  editor :"DisplayField",
		  renderer:function (val) {
			  if(val=="")
				   return "";
				if (val){					
					if(typeof val=='string'){
						val=this.item["A.dtCheck"];
					}
						var dt = new Date();
	    			    dt.setTime(val);
						return Ext.Date.format(dt,'Y-m-d H:i');
				}
			  },
	     cfg:{readOnly:true},
	     width:150
	  }
	 },
   child_views : [{
     title:"明细表",
     vn:"dao.hb.BxDetailrecordRead",
   func_filter: function(robj, ui) {
     var cn = robj.cns[0];
     var hql = " from BxDetailrecord where bxsrPid=" + (robj.items.map['A.id'] || 0)+" order by id";    
     ui.setHQL(hql);
   },
   func_setdefault:function(robj,objs){
     objs[0].items.map["bxsrPid"]=robj.items.map['A.id'];
     objs[0].items.map["uid"]=robj.items.map['A.uid'];
   }
   }]
 },
 "dao.hb.BxSimplerecordPrint":{
	 req:{
		 "pss":[["id","uid","uname","recorder","receiptsNum","bxSum","prebxCost","preRemark","reason","newRemark","remark","dtCreate","dtModify","status","dtSubmit","dtCheck"],["id","name"]],
		 "cns":["dao.hb.BxSimplerecord","dao.hb.UUser"],
		 "hql":"from BxSimplerecord A , UUser B where A.uid=B.id"
	 },
	cfg_detail:{
		btns:["游标",{
		      text : '打印',
		      cls : 'x-btn-text-icon',
		      icon : 'icons/email_link.png',
		      handler : function(btn) {
		         var divId=this.tabDetail.id+'-body';
		         var panel=document.getElementById(divId);  
		         var newstr = panel.innerHTML;  
		         BView.print(newstr);
		      }
		    }],
		tabs:[{
			title : "基本信息",
			fset : [{
				legend : "",
				props :["A.id","B.name","A.recorder","A.status","A.receiptsNum","A.bxSum"]
			},{
				legend : "",
				props :["A.newRemark","A.reason"]
			},{
				legend : "",
				props :["A.dtModify","A.dtCreate","A.dtSubmit","A.dtCheck"]
			}]
			}
		
		]},
	cfg_grid:{
      btns : ['检索', '刷新'],
      hide: ["A.status"]
	},
	 cfg_prop:{
	  "A.id":{
		  display:"序号",
		  editor :"DisplayField"
	  },
	  "A.uid":{
		  display:"申请人",
		  editor :"DisplayField",
		  hidden:true
	  },
	  "A.reason":{
		  display:"补充说明",
		  editor:"DisplayField",
		  hidden:true
	  },
	  "B.name":{
		  display:"姓名",
		  editor:"DisplayField",
		  width:100
	  },
	  "A.newRemark":{
		  display:"报销说明",
		  editor:"DisplayField"
	  },
	  "B.id":{
		  display:"用户编号",
		  editor:"DisplayField",
		  hidden:true
	  },
	  "A.bxSum":{
		  display:"报销总额",
		  editor :"DisplayField"  
	  },
	  "A.prebxCost":{
		  display:"预报销总额",
		  hidden:true,
		  editor :"DisplayField"
	  },
	  "A.preRemark":{
		  display:"预报销说明",
		  hidden:true,
		  editor:"DisplayField"
	  },
	  "A.uname":{
	    display:"报销申请人",
	    editor :"DisplayField",
	    hidden:true
	    
	  },
	  "A.recorder":{
	    display:"录入人",
	    editor :"DisplayField"
	  },
 
      "A.remark":{
		  display:"报销说明",
		  editor :"DisplayField",
		  hidden:true
	  },
	  "A.preRemark":{
		  display:"预报销说明",
		  editor :"DisplayField",
		  hidden:true,
		  height:300,
		  width:300
	  },
	 
     "A.status":{
          hidden: true,
		  display:"报销状态",
		  editor :"DisplayField",
		  cfg:{readOnly:true}  
	  },
	  "A.receiptsNum":{
		  display:"单据张数",
		  editor :"DisplayField"
	  },
      "A.dtCreate":{
		  display:"创建日期",
		  editor :"DisplayField",
		  serchDate:true,
		  renderer:function (val) {
			  if(val=="")
				   return "";
				if (val){					
					if(typeof val=='string'){
						val=this.item["A.dtCreate"];
					}
						var dt = new Date();
	    			    dt.setTime(val);
						return Ext.Date.format(dt,'Y-m-d H:i');
				}
			  },
	     cfg:{readOnly:true,readOnlyCls:'form_date_readonly'},
	     hidden:true,
	     width:150
	  },
	  "A.dtModify":{
		  display:"修改日期",
		  editor :"DisplayField",
		  renderer:function (val) {
			  if(val=="")
				   return "";
				if (val){			
					if(typeof val=='string'){
						val=this.item["A.dtModify"];
					}
						var dt = new Date();
	    			    dt.setTime(val);
						return Ext.Date.format(dt,'Y-m-d H:i');
				}
			  },      
	      hidden:true,
	      width:150
	  },
      "A.dtSubmit":{
		  display:"提交日期",
		  editor :"DisplayField",
		  renderer:function (val) {
			  if(val=="")
				   return "";
				if (val){					
					if(typeof val=='string'){
						val=this.item["A.dtSubmit"];
					}
						var dt = new Date();
	    			    dt.setTime(val);
						return Ext.Date.format(dt,'Y-m-d H:i');
				}
			  },
	      cfg:{readOnly:true},
	      hidden:true,
	      width:150
	  },
	  "A.dtCheck":{
		  display:"审核日期",
		  editor :"DisplayField",
		  renderer:function (val) {
			  if(val=="")
				   return "";
				if (val){					
					if(typeof val=='string'){
						val=this.item["A.dtCheck"];
					}
						var dt = new Date();
	    			    dt.setTime(val);
						return Ext.Date.format(dt,'Y-m-d H:i');
				}
			  },
	     cfg:{readOnly:true},
	     width:150
	  }
	 },
   child_views : [{
     title:"明细表",
     vn:"dao.hb.BxDetailrecordRead",
   func_filter: function(robj, ui) {
     var cn = robj.cns[0];
     var hql = " from BxDetailrecord where bxsrPid=" + (robj.items.map['A.id'] || 0)+" order by id";    
     ui.setHQL(hql);
   },
   func_setdefault:function(robj,objs){
     objs[0].items.map["bxsrPid"]=robj.items.map['A.id'];
     objs[0].items.map["uid"]=robj.items.map['A.uid'];
   }
   }]
 },
 "dao.hb.BxSimplerecordReadA":{
	 req:{
		 "pss":[["id","name"],["id","uid","uname","recorder","receiptsNum","bxSum","prebxCost","preRemark","reason","newRemark","remark","dtCreate","dtModify","status","dtSubmit","dtCheck"]],
		 "cns":["dao.hb.UUser","dao.hb.BxSimplerecord"],
		 "hql":"from UUser A , BxSimplerecord B  where B.uid=A.id",
		 "close":"true"
	 },
	cfg_detail:{
		//btns:["游标"],
		tabs:[{
			title : "基本信息",
			fset : [{
				legend : "",
				props :["B.id","A.name","B.recorder","B.status","B.receiptsNum"]
			}/**,{
				legend : "",
				props :["B.prebxCost","B.preRemark"]
			}**/,{
				legend : "",
				props :["B.bxSum","B.newRemark"]
			},{
				legend : "",
				props :["B.reason","B.dtModify","B.dtCreate","B.dtSubmit","B.dtCheck"]
			}]
			}
		
		]},
	cfg_grid:{
      btns : ['日期',{
	      text:  '报表统计',
	      cls: 'x-btn-text-icon',
	      icon : 'icons/chart_pie.png',
	      menu : new Ext.menu.Menu({
	          items : [{  
		            text:"门急诊",
		            scope : this,
		            handler : function(btn,item){
		            	var ui=BView.getUi(btn);
	                var firstDate = ui.firstDate.getValue();
	                var secondDate = ui.secondDate.getValue();
	                if (firstDate==null || secondDate==null){     
	                  Ext.MessageBox.alert("操作提示","请选择待统计记录的看病日期起始时间段。");
	                  return; 
	                }else{
	                    var dt = new Date();
	                    dt.setTime(firstDate);
	                    firstDate = Ext.Date.format(dt,'Y-m-d');
	                    dt.setTime(secondDate);
	                    secondDate = Ext.Date.format(dt,'Y-m-d');
	                    if(firstDate>secondDate){	            
	                      var a = secondDate;
	                      secondDate = firstDate;
	                      firstDate = a;	                      
	                    }
		            var baseURL =CFG.app_ctx+"servlet/StactisticHandler?"; 
		            var url = baseURL+"&type=P&uid="+layout.uid+"&start="+firstDate+"&end="+secondDate;
		            window.open(url,'_blank');    
	           
	         }} 
	       
	         },{  
			         text:"住院",
			         scope : this,
			         handler : function(btn,item){
			        	 var ui=BView.getUi(btn);
		              var firstDate = ui.firstDate.getValue();
                  var secondDate = ui.secondDate.getValue();
                  if (firstDate==null || secondDate==null){     
                    Ext.MessageBox.alert("操作提示","请选择待统计记录的看病日期起始时间段。");
                    return; 
                  }else{
                      var dt = new Date();
                      dt.setTime(firstDate);
                      firstDate = Ext.Date.format(dt,'Y-m-d');
                      dt.setTime(secondDate);
                      secondDate = Ext.Date.format(dt,'Y-m-d');
                      if(firstDate>secondDate){              
                        var a = secondDate;
                        secondDate = firstDate;
                        firstDate = a;                        
                      }
			         var baseURL =CFG.app_ctx+"servlet/StactisticHandler?"; 
			         var url = baseURL+"&type=Z&uid="+layout.uid+"&start="+firstDate+"&end="+secondDate;
			         window.open(url,'_blank');    
        
             } }
    
        },{
        	  
	         text:"计划生育",
	         scope : this,
	         handler : function(btn,item){
	        	 var ui=BView.getUi(btn);
             var firstDate = ui.firstDate.getValue();
         var secondDate = ui.secondDate.getValue();
         if (firstDate==null || secondDate==null){     
           Ext.MessageBox.alert("操作提示","请选择待统计记录的看病日期起始时间段。");
           return; 
         }else{
             var dt = new Date();
             dt.setTime(firstDate);
             firstDate = Ext.Date.format(dt,'Y-m-d');
             dt.setTime(secondDate);
             secondDate = Ext.Date.format(dt,'Y-m-d');
             if(firstDate>secondDate){              
               var a = secondDate;
               secondDate = firstDate;
               firstDate = a;                        
             }
	         var baseURL =CFG.app_ctx+"servlet/StactisticHandler?"; 
	         var url = baseURL+"&type=S&uid="+layout.uid+"&start="+firstDate+"&end="+secondDate;
	         window.open(url,'_blank');    

    } }


        }]
          
	      })

	    }],
      hide: ["B.status"]
	},
	 cfg_prop:{
	  "A.id":{
		  display:"用户编号",
		  hidden:true
	  },
	  "B.id":{
		  display:"序号",
		  editor :"DisplayField",
		  hidden:true
	  },
	  "A.name":{
		 editor:"DisplayField",
		 display:"报销人"  
	  },
	  "B.reason":{
		  display:"补充说明",
		  editor:"DisplayField",
		  hidden:true
	  },
	  "B.uid":{
		  display:"申请人",
		  hidden:true,
		  renderer:function(val){
			  var hql="from UUser where id="+val;
			  var url = CFG.app_ctx+"servlet/JSonBaseServlet?hql=select id,userId,name,namePyh from UUser where id="+val;
			  return url.name;
		  }
	  },
	  "B.newRemark":{
		  display:"报销说明",
		  editor:"DisplayField"
	  },
	  "B.bxSum":{
		  display:"报销总额",
		  editor :"DisplayField"  
	  },
	  "B.prebxCost":{
		  display:"预报销总额",
		  editor :"DisplayField",
		  hidden:true
	  },
	  "B.uname":{
	    display:"报销申请人",
	    editor :"DisplayField",
	    hidden:true
	  },
	  "B.recorder":{
	    display:"录入人",
	    editor :"DisplayField"
	  },
      "B.dtCreate":{
		   display:"创建日期",
		   editor:"DateField",
		   cfg:{readOnly:true,readOnlyCls:'form_date_readonly'},
	     hidden:true,
	     width:150
	  },
      "B.remark":{
		  display:"报销说明",
		  editor :"DisplayField",
		  hidden:true,
		  cfg:{
			  height:200,
			  width:500 
		  },
		  height:300,
		  width:300
	  },
	  "B.preRemark":{
		  display:"预报销说明",
		  editor :"DisplayField",
		  hidden:true,
		  height:300,
		  width:300
	  },
	  "B.dtModify":{
		  display:"修改日期",
		  editor:"DateField",
		  cfg:{readOnly:true,readOnlyCls:'form_date_readonly'},
	      hidden:true,
	      width:150
	  },
     "B.status":{
          hidden: true,
		  display:"报销状态",
		  editor :"DisplayField",
		  cfg:{readOnly:true}  
	  },
	  "B.receiptsNum":{
		  display:"单据张数",
		  editor :"DisplayField"
	  },
      "B.dtSubmit":{
		  display:"提交日期",
		  editor:"DateField",
		  cfg:{readOnly:true,readOnlyCls:'form_date_readonly'},
	      hidden:true,
	      width:150
	  },
	  "B.dtCheck":{
		  display:"审核日期",
		  editor:"DateField",
		  cfg:{readOnly:true,readOnlyCls:'form_date_readonly'},
	     width:150
	  }
	 },
   child_views : [{
     title:"明细表",
     vn:"dao.hb.BxDetailrecordReadA",
   func_filter: function(robj, ui) {
     var cn = robj.cns[0];
     var hql = " from BxDetailrecord where bxsrPid=" + (robj.items.map['B.id'] || 0)+" order by id";    
     ui.setHQL(hql);
   },
   func_setdefault:function(robj,objs){
     objs[0].items.map["bxsrPid"]=robj.items.map['B.id'];
     objs[0].items.map["uid"]=robj.items.map['B.uid'];
   }
   }]
 },
 //===================================================14.01.03=============================================
 
 
 
 
 "dao.hb.OAttach":{
	req:{
		"pss" : [["id","entityName", "entityId","name","stype", "size","path","status","tmCreate","tmModify","remark"]],
		"cns" : ["dao.hb.OAttachment"],
		"hql" : "from OAttachment"
	},
	cfg_detail:{
	btns:["保存"],
	tabs:[{
		title : "基本信息",
		fset : [{
			legend : "",
			props :["id","entityName", "entityId","name","stype", "size","path","status","tmCreate","tmModify"]
		}]
		},{
		title : "备注",
		fset : [{
			legend : "",
			props :["remark"]
		}]
	}]},
	cfg_grid:{
		btns:['增加','删除','打开','保存','检索','刷新','排序',{
	   		text: '比对',
	        cls: 'x-btn-text-icon',
	        icon: 'icons/connect.png',
			handler : function(btn){
              var ui=btn.ui;
			  var sels=btn.ui.grid.getSelectionModel().getSelections();
			  if(!sels || sels.length==0){
			  	return;
			  }
		  	layout.showTabPicc();
	        var dh = Ext.DomHelper;
	        var ct_picc = Ext.getDom("tabs_picc");
	        var pos_left=0;
	        var pos_top = 0;
  		for(var i=0; i<sels.length; i++){
			var src = BView.get_attach_url(sels[i].obj.items.map.path);
        	layout.addtp(src);
			}
		}}],
		hide: ["tmCreate","tmModify","remark"]
	},
	cfg_prop:{
	"id":{
	  display:'序号',
	  cfg:{
	  	readOnly:true
	  }
	},
	"status":{
	 display:"状态",
		editor : 'ComboBox',
		cfg :BView.func_cfg_combo([['启用', 1], ['禁用', 0]])
	},
	"entityName":{
	 display:'数据库表',
	 	  cfg:{
	  	readOnly:true
	 },
	 editor : 'ComboBox',
	 cfg :BView.func_cfg_combo_hql("LIST_ENTITYS","id")
	},
	"entityId":{
	 display:"记录编号"
	},
	"name":{
	 display:"附件名"
	},
	"stype":{
	 display:"附件分类"
	},
	"size":{
	 display:"文件长度"
	},
	"path":{
		display:'附件路径',
		editor:"FileField"
	},
	"tmModify":{
	  editor:"DateField",
	  display:'更新时间',
	  dcfg:{
		readOnly:true
	 }
	},	
	"tmCreate":{
	  editor:"DateField",
	  display:'建立时间',
	  dcfg:{
		readOnly:true
	 }
	},"remark":{
	  display:'备注',
	  editor:"TextArea"
	}
  }
 },	
	

 "dao.hb.NSort":{
	req:{
		"pss" : [["id","nid", "uid","title","pid","dtCreate"]],
		"cns" : ["dao.hb.NSort"],
		"hql" : "from NSort"
	},
	cfg_detail:{
		btns:["保存"]
	},	
	cfg_prop:{
	"id":{
	  display:'序号',
	  cfg:{
	  	readOnly:true
	  }
	},
	"nid":{
	 display:"主节点"
	},
	"title":{
	 display:"题名"
	},	
	"uid":{
	 display:"编辑者"
	},	
	"pid":{
	 display:"父节点"
	},
	"dtCreate":{
	  editor:"DateField",
	  display:'建立时间',
	  cfg:{
		readOnly:true
	 	}  
	 }
	}
 },


"dao.hb.NImage":{
	req:{
		"pss" : [["id","nid", "uid","title","detail","width","height","fsize","uri","dtCreate"]],
		"cns" : ["dao.hb.NImage"],
		"hql" : "from NImage"
	},
	cfg_detail:{
		btns:["保存"]
	},	
	cfg_prop:{
	"id":{
	  display:'序号',
	  cfg:{
	  	readOnly:true
	  }
	},
	"nid":{
	 display:"主节点"
	},
	"title":{
	 display:"题名"
	},	
	"uid":{
	 display:"编辑者"
	},	
	"detail":{
	 display:"描述"
	},
	"width":{
	 display:"宽度"
	},
	"height":{
	 display:"高度"
	},
	"fsize":{
	 display:"文件尺寸"
	},
	"uri":{
	 display:"路径",
	 editor:"FileField"
	},
	"dtCreate":{
	  editor:"DateField",
	  display:'建立时间',
	  dcfg:{
		readOnly:true
	 	}  
	 }
	}
 },
 
 "dao.hb.NMenu":{
	req:{
		"pss" : [["id","nid", "uid","title","status","stype","price","priceUnit","runtime","summery","style","uriMedia","dtCreate","dtModify"]],
		"cns" : ["dao.hb.NMenu"],
		"hql" : "from NMenu"
	},
	cfg_grid:{
		hide: ["summery","style"]
	},
	cfg_detail:{
		btns:["保存"],
	 tabs:[{
		title : "基本信息",
		fset : [{
			legend : "",
			props :["id","nid", "uid","title","status","stype","price","priceUnit","runtime","uriMedia","dtCreate","dtModify"]
		}]
		},{
			title : "简介",
			fset : [{
				legend : "",
				props :["summery"]
			}]
		},{
			title : "可选做法",
			fset : [{
				legend : "",
				props :["style"]
			}]
		}]
	},	
	cfg_prop:{
	"price":{
	 display:"价格"
	},
	"priceUnit":{
	 display:"价格单位"
	},
	"runtime":{
	 display:"做菜时长"
	},
	"id":{
	  display:'序号',
	  cfg:{
	  	readOnly:true
	  }
	},
	"nid":{
	 display:"主节点"
	},
	"title":{
	 display:"题名"
	},	
	"uid":{
	 display:"编辑者"
	},
	"uriMedia":{
	 display:"音视频"
	},
	"style":{
	 display:"可选做法",
	 editor:"TextArea"
	},
	"status":BView.cfg_status,
	"stype":{
	 display:"分类"
	},
	"summery":{
	 display:"简介",
	 editor:"TextArea"
	},
	"dtCreate":{
	  editor:"DateField",
	  display:'建立时间',
	  dcfg:{
		readOnly:true
	 	}  
	 },
	"dtModify":{
	  editor:"DateField",
	  display:'最近修改',
	  dcfg:{
		readOnly:true
	 	}  
	 }

	}
 }, 
 "dao.hb.NRestaurant":{
 	//Integer nid, Integer uid, Integer rid, String title, Integer status, String stype, String city, Float longitude, Float latitude, Integer outgoing, String summery, String homepage, String contact, String descTicket, String descOpen, String descTraffic, String uriMedia, Date dtCreate, Date dtModify
	req:{
		"pss" : [["id","nid", "uid","title","status","outgoing","stype","city","longitude","latitude","summery","homepage","contact","descTicket","descOpen","descTraffic","dtCreate","dtModify"]],
		"cns" : ["dao.hb.NRestaurant"],
		"hql" : "from NRestaurant"
	},
	cfg_grid:{
		hide: ["summery","contact","descTicket","descOpen","descTraffic"]
	},
	cfg_detail:{
		btns:["保存"],
	 tabs:[{
		title : "基本信息",
		fset : [{
			legend : "",
			props :["id","nid", "uid","title","stype","city","longitude","latitude","outgoing","dtCreate"]
		}]
		},{
			title : "简介",
			fset : [{
				legend : "",
				props :["summery"]
			}]
		},{
		title : "联系方式",
		fset : [{
			legend : "",
			props :["contact"]
		}]
		},{
			title : "票务信息",
			fset : [{
				legend : "",
				props :["descTicket"]
			}]
		},{
			title : "营业",
			fset : [{
				legend : "",
				props :["descOpen"]
			}]
		},{
			title : "交通路线",
			fset : [{
				legend : "",
				props :["descTraffic"]
			}]
		}]
	},	
	cfg_prop:{
	"id":{
	  display:'序号',
	  cfg:{
	  	readOnly:true
	  }
	},
	"nid":{
	 display:"主节点"
	},
	"title":{
	 display:"题名"
	},	
	"uid":{
	 display:"编辑者"
	},	
	"stype":{
	 display:"分类",
		editor:"TreeCombo",
		cfg:{
			sepperator:';',
	        width: 400,
	        listWidth:320,
	        lazyInit:false,
			store: new Ext.data.TreeStore({
                proxy: {
                    type: 'ajax',
                    url: 'class_restaurant.json'
                },
                sorters: [{
                    property: 'leaf',
                    direction: 'ASC'
                }, {
                    property: 'text',
                    direction: 'ASC'
                }]
            })
		}
	},
	"city":{
	 display:"城市",
		editor:"TreeCombo",
		cfg:{
           singleSelect:true,
			isExpanded:false,
	        width: 400,
	        listWidth:320,
	        lazyInit:true,
			store: new Ext.data.TreeStore({
                proxy: {
                    type: 'ajax',
                    url: 'citys.json'
                },
                sorters: [{
                    property: 'leaf',
                    direction: 'ASC'
                }, {
                    property: 'text',
                    direction: 'ASC'
                }]
            })
		}
	},
	"longitude":{
	 display:"经度"
	},
	"latitude":{
	 display:"纬度"
	},
	"summery":{
	 display:"简介",
	 editor:"TextArea"
	},
	"homepage":{
	 display:"网站主页"
	},
	"contact":{
	 display:"联系方式",
	 editor:"TextArea"
	},
	"descTicket":{
	 display:"最低消费",
	 editor:"TextArea"
	},
	"outgoing":{
	 display:"送餐范围"
	},
	"descOpen":{
	 display:"开放时间",
	 editor:"TextArea"
	},
	"descTraffic":{
	 display:"交通线路",
	 editor:"TextArea"
	},
	"status":BView.cfg_status,
	"dtCreate":{
	  editor:"DateField",
	  display:'建立时间',
	  dcfg:{
		readOnly:true
	 	}  
	 },
	"dtModify":{
	  editor:"DateField",
	  display:'最近修改',
	  dcfg:{
		readOnly:true
	 	}  
	 }
	}
 },
"dao.hb.NBase":{
	req:{
		"pss" : [["id","vid", "itype","language","title","uid","statusPublish","statusComment","dtCreate","dtModify","tnid","pnid","ord"]],
		"cns" : ["dao.hb.NBase"],
		"hql" : "from NBase"
	},
	cfg_grid:{
		btns:['增加','删除','打开','保存','检索','刷新','排序'],
		hide: ["remark"]
	},
	cfg_detail:{
		btns:["保存"]
	},	
	cfg_prop:{
	"id":{
	  display:'序号',
	  cfg:{
	  	readOnly:true
	  }
	},
	"vid":{
	 display:"当前版本"
	},
	"itype":{
	 display:"类型",
		editor : 'ComboBox',
		cfg :BView.func_cfg_combo([['餐馆', 1],['图片',2],['分类',3],['菜品',4]])
	},
	"language":{
	 display:"语种",
	 editor : 'ComboBox',
	 cfg :BView.func_cfg_combo_hql("LIST_LANG_","id")
	},	
	"title":{
	 display:"题名"
	},	
	"uid":{
	 display:"编辑者"
	},	
	"statusPublish":{
	 display:"发布状态",
		editor : 'ComboBox',
		cfg :BView.func_cfg_combo([['隐藏', 0],['超稿',1],['发布',2]])
	},
	"statusComment":{
	 display:"评论状态",
		editor : 'ComboBox',
		cfg :BView.func_cfg_combo([['禁止', 0],['允许',1]])
	},
	"dtCreate":{
	  editor:"DateField",
	  display:'建立时间',
	  dcfg:{
		readOnly:true
	 	}  
	 },
	"dtModify":{
	  editor:"DateField",
	  display:'最后修改',
	  dcfg:{
		readOnly:true
	 	}
	},
	"tnid":{
	  display:'翻译节点'
	},
	"pnid":{
	  display:'父节点'
	},
	"ord":{
	  display:'顺序'
	}
	},
	child_views : [{
  	title:"翻译",
  	vn:"dao.hb.NBase",
	func_filter: function(robj, ui) {
		var hql = " from NBase where  tnid=" + (robj.items.map['id'] || 0)+" order by id";		
		ui.setHQL(hql);
	},
	func_setdefault:function(robj,objs){
		objs[0].items.map["tnid"]=robj.items.map['id'];
	}
  },{
  	title:"菜品分类",
  	vn:"dao.hb.NSort",
  	func_limit:function(robj){
  		return robj.items.map['itype']==1;
  	},
  	func_view:function(vw,robj){
  		vw.cfg_grid.btns=['增加','删除','打开','保存','检索','刷新','排序',BView.btns["copyto"],BView.btns["json_cls"]];
  		vw.robj = robj;
  	},
	func_filter: function(robj, ui) {
		var hql = " from NSort where  nid=" + (robj.items.map['id'] || 0)+" order by id";		
		ui.setHQL(hql);
	},
	func_setdefault:function(robj,objs){
		objs[0].items.map["nid"]=robj.items.map['id'];
	}
  },{
  	title:"相关图片",
  	vn:"dao.hb.NBase",
  	func_limit:function(robj){
  		return robj.items.map['itype']==1 || robj.items.map['itype']==4;
  	},
	func_filter: function(robj, ui) {
		var hql = " from NBase where itype=2 and pnid=" + (robj.items.map['id'] || 0)+" order by id";		
		ui.setHQL(hql);
	},
	func_setdefault:function(robj,objs){
		objs[0].items.map["pnid"]=robj.items.map['id'];
		objs[0].items.map["itype"]=2;
	}
  },{
  	title:"相关菜品",
  	vn:"dao.hb.NBase",
  	func_limit:function(robj){
  		return robj.items.map['itype']==1;
  	},
  	func_view:function(vw,robj){
  		vw.cfg_grid.btns=['增加','删除','打开','保存','检索','刷新','排序',BView.btns["copyto"]];
  	},
	func_filter: function(robj, ui) {
		var hql = " from NBase where itype=4 and pnid=" + (robj.items.map['id'] || 0)+" order by id";		
		ui.setHQL(hql);
	},
	func_setdefault:function(robj,objs){
		objs[0].items.map["pnid"]=robj.items.map['id'];
		objs[0].items.map["itype"]=4;
	}
  },{
  	title:"餐馆历史版本",
  	vn:"dao.hb.NRestaurant",
  	func_limit:function(robj){
  		return robj.items.map['itype']==1;
  	},
	func_filter: function(robj, ui) {
		var hql = " from NRestaurant where nid=" + (robj.items.map['id'] || 0)+" order by id";		
		ui.setHQL(hql);
	},
	func_setdefault:function(robj,objs){
		objs[0].items.map["nid"]=robj.items.map['id'];
	}
  },{
  	title:"菜品历史版本",
  	vn:"dao.hb.NMenu",
  	func_limit:function(robj){
  		return robj.items.map['itype']==4;
  	},
  	func_view:function(vw,robj){
   		vw.cfg_prop["stype"].cfg .loader={
            	autoLoad: true,
               // url:'class_mnu.json',
              	url:Bat.WC +'servlet/JSonBaseServlet?nid='+robj.items.map['pnid']
            };
  	},
	func_filter: function(robj, ui) {
		var hql = " from NMenu where nid=" + (robj.items.map['id'] || 0)+" order by id";		
		ui.setHQL(hql);
	},
	func_setdefault:function(robj,objs){
		objs[0].items.map["nid"]=robj.items.map['id'];
	}
  },{
  	title:"图片历史版本",
  	vn:"dao.hb.NImage",
  	func_limit:function(robj){
  		return robj.items.map['itype']==2;
  	},  	
	func_filter: function(robj, ui) {
		var hql = " from NImage where nid=" + (robj.items.map['id'] || 0)+" order by id";		
		ui.setHQL(hql);
	},
	func_setdefault:function(robj,objs){
		objs[0].items.map["nid"]=robj.items.map['id'];
	}
  }]
 },

 "dao.hb.OLocation":{
	req:{
		"pss" : [["id","uid","dtCreate","dtModify","remark","status", "name", "longitude","latitude","bw","bn","be","bs"]],
		"cns" : ["dao.hb.OLocation"],
		"hql" : "from OLocation"
	},
	func_title: function(o){ return o.items.map['name']+'详细信息'; },
	cfg_detail:{
	 btns:["保存"],
	 tabs:[{
		title : "基本信息",
		fset : [{
			legend : "",
			props :["id","uid","dtCreate","dtModify","status", "name", "longitude","latitude"]
		}]
		},{
		title : "备注",
		fset : [{
			legend : "",
			props :["remark"]
		}]
	}]},
	cfg_grid:{
		btns:['增加','打开','保存','检索','刷新','排序',{
	   		text: '地图',
	        cls: 'x-btn-text-icon',
	        icon: 'icons/world.png',
			handler : function(btn){
				BView.openTabpanel("map","城区图","../ol/bm.html");
			}}],
		hide: ["remark"]
	},
	cfg_prop:{
	"id":{
	  display:'序号',
	  cfg:{
	  	readOnly:true
	  }
	},
	"name":{
	 display:"名称"
	},
	"code":{
	 display:"编号"
	},
	"longitude":{
	 display:"X坐标"
	},"latitude":{
	 display:"Y坐标"
	},
	"status":BView.cfg_status,
	"dtModify":{
	  editor:"DateField",
	  display:'更新时间',
	  dcfg:{
		readOnly:true
	 }
	},	
	"dtCreate":{
	  editor:"DateField",
	  display:'建立时间',
	  dcfg:{
		readOnly:true
	 }
	},"remark":{
	  display:'备注',
	  editor:"TextArea"
	}	

	
  },child_views : [{
  	title:"相关设备",
  	vn:"dao.hb.ODevice",
	func_filter: function(robj, ui) {
		var cn = robj.cns[0];
		var hql = " from ODevice where sid=" + (robj.items.map['id'] || 0)+" order by id";		
		ui.setHQL(hql);
	},
	func_setdefault:function(robj,objs){
		objs[0].items.map["sid"]=robj.items.map['id'];
	}
  },{
  	title:"相关附件",
  	vn:"dao.hb.OAttachment",
	func_filter: function(robj, ui) {
		var cn = robj.cns[0];
		var hql = " from OAttachment where entityName='"
		+ robj.cns[0]+"' and entityId=" + (robj.items.map['id'] || 0);		
		ui.setHQL(hql);
	},
	func_setdefault:function(robj,objs){
		objs[0].items.map["entityName"]="dao.hb.OLocation";
		objs[0].items.map["entityId"]=robj.items.map['id'];
	}
  }],
  rel_views:[{
  	title:"关联附件",
  	vt:{
  		vn:"dao.hb.ODevice",
  		title:"已关联附件"
  	},
  	vs:{
  		vn:"dao.hb.UUser",
  		title:"可选附件"
  	}
  }]
 },
 "dao.hb.ODevice":{
 	func_item:function(vw,robj){
 		
 	},
	req:{
		"pss" : [["id","mid","sid","dtCreate","dtModify","remark","status","sno","name","ipAddr"]],
		"cns" : ["dao.hb.ODevice"],
		"hql" : "from ODevice order by id"
	},
	cfg_detail:{
	btns:["保存","游标"],
	tabs:[{
		title : "基本信息",
		fset : [{
			legend : "",
			props :["id","mid","sid","status","sno","name","ipAddr"]
		}]
		},{
		title : "备注",
		fset : [{
			legend : "",
			props :["dtCreate","dtModify","remark"]
		}]
	}]},
	cfg_grid:{
		btns:['增加','删除','打开','保存',{
			text : '操作',
			cls : 'x-btn-text-icon',
			icon : '../bat/icons/refresh.png',
			menu : {
                items: [{
                	text:'设备配置',
                	handler:function(b,e){
						BView.openTabpanel("config","设备配置","config.jpg");
               	},scope:this
                },{
                	text:'画面线框',
                	handler:function(b,e){
                		BView.openTabpanel("poly","画面线框","poly.jpg");
                	},scope:this
                },{
                	text:'历史数据',
                	handler:function(b,e){
                		BView.openTabpanel("pasttime","历史数据","show.jpg");
                	},scope:this
                }]
			}
		},'检索','刷新','排序'],
		hide: ["dtCreate","dtModify","remark"]
	},
	cfg_prop:{
	"id":{
	  display:'序号',
	  cfg:{
	  	readOnly:true
	  }
	},
	"mid":{
	 display:"设备类型",
	 editor : 'ComboBox',
	 cfg :BView.func_cfg_combo_hql("select id,name from ODeviceType order by id","id")
	},
	"sid":{
	 display:"位置序号"
	},
	"sno":{
	 display:"设备编号"
	},
	"name":{
	 display:"设备名称" 
	},
	"ipAddr":{
	 display:"ip地址"
	},
	"status":{
	 display:"状态",
		editor : 'ComboBox',
		cfg :BView.func_cfg_combo([['启用', 1], ['禁用', 0], ['备用', 2]])
	},
	"dtModify":{
	  editor:"DateField",
	  display:'更新时间',
	  dcfg:{
		readOnly:true
	 }
	},	
	"dtCreate":{
	  editor:"DateField",
	  display:'建立时间',
	  dcfg:{
		readOnly:true
	 }
	},"remark":{
	  display:'备注',
	  editor:"HtmlEditor"
	}	
  }
 },
 "dao.hb.ODeviceType":{
	req:{
		"pss" : [["id","dtCreate","dtModify","remark","name","smode","stype","attrLabel","attrTip","handle","handlePara","status"]],
		"cns" : ["dao.hb.ODeviceType"],
		"hql" : "from ODeviceType"
	},
	cfg_detail:{
	btns:["保存"],
	tabs:[{
		title : "基本信息",
		fset : [{
			legend : "",
			props :["id","dtCreate","dtModify","name","smode","stype","attrLabel","attrTip","handle","handlePara"]
		}]
		},{
		title : "handle参数",
		fset : [{
			legend : "",
			props :["handlePara"]
		}]
		},{
		title : "备注",
		fset : [{
			legend : "",
			props :["remark"]
		}]
		}
	]},
	cfg_grid:{
		hide: ["remark","handlePara"]
	},
	cfg_prop:{
	"id":{
	  display:'设备类型id',
	  cfg:{
	  	readOnly:true
	  }
	},
	"attrLabel":{
	 display:"实时显示属性"	 
	},
	"attrTip":{
	 display:"tip显示属性"
	},
	"name":{
	 display:"名称"	 
	},
	"stype":{
	 display:"分类"
	},
	"handle":{
	 display:"handle处理",
		editor : 'ComboBox',
		cfg :BView.func_cfg_combo([['THEnum', "THEnum"],['THXXX', "THXXX"]])
	},
	"smode":{
	 display:"采集方式",
		editor : 'ComboBox',
		cfg :BView.func_cfg_combo([['Robot', "Robot"],['Cam', "Cam"],['CAM_Robot', "CAM_Robot"],['GTI_Robot', "GTI_Robot"],['Snmp', "Snmp"],['Serial','Serial'],['Local','Local'],['Virtual','Virtual']])
	},
	"status":{
	 display:"状态",
		editor : 'ComboBox',
		cfg :BView.func_cfg_combo([['启用', 1], ['禁用', 0], ['备用', 2]])
	},
	"dtModify":{
	  editor:"DateField",
	  display:'更新时间',
	  dcfg:{
		readOnly:true
	 }
	},	
	"dtCreate":{
	  editor:"DateField",
	  display:'建立时间',
	  dcfg:{
		readOnly:true
	 }
	},"trapDesc":{
	  display:'trap描述',
	  editor:"TextArea"
	},"remark":{
	  display:'备注',
	  editor:"TextArea"
	}	
  },child_views : [{
  	title:"相关菜单项",
  	vn:"dao.hb.ODeviceManage",
	func_filter: function(robj, ui) {
		var cn = robj.cns[0];
		var hql = " from ODeviceManage where mid=" + (robj.items.map['id'] || 0);	
		ui.setHQL(hql);
	},
	func_setdefault:function(robj,objs){
		objs[0].items.map["mid"]=robj.items.map['id'];
	}
  },{
  	title:"相关属性",
  	vn:"dao.hb.ODeviceItem",
	func_filter: function(robj, ui) {
		var cn = robj.cns[0];
		var hql = " from ODeviceItem where mid=" + (robj.items.map['id'] || 0);	
		ui.setHQL(hql);
	},
	func_setdefault:function(robj,objs){
		objs[0].items.map["mid"]=robj.items.map['id'];
	}
  }
  ]
 },

 "dao.hb.ODeviceManage":{
	req:{
		"pss" : [["id","mid","mode","uri","name","mnuOrd"]],
		"cns" : ["dao.hb.ODeviceManage"],
		"hql" : "from ODeviceManage"
	},
	cfg_detail:{
	btns:["保存"],
	tabs:[{
		title : "基本信息",
		fset : [{
			legend : "",
			props :["id","mid","mode","uri","name","mnuOrd"]
		}]
		}
		]},
	cfg_grid:{
		//hide: ["id","mid","mode","uri","name","mnuOrd"]
	},
	cfg_prop:{
	"id":{
	  display:'序号',
	  cfg:{
	  	readOnly:true
	  }
	},
	"mid":{
	 display:"设备类型序号"	 
	}
  }
  },
 
 "dao.hb.ODeviceItem":{
	req:{
		"pss" : [["id","mid", "name","dispalyname", "style","styleParam","valtype","ordernum","vaildconditon","rule","coefficient","unit","oid","tmCreate","tmModify","remark","spanVal","spanQuery"]],
		"cns" : ["dao.hb.ODeviceItem"],
		"hql" : "from ODeviceItem"
	},
	cfg_detail:{
		btns:["保存"],
		tabs:[{
		title : "配置属性",
		fset : [{
			legend : "",
			props :["id","mid", "name","dispalyname","coefficient","unit","oid"]
		}]
		},{
		title : "状态属性",
		fset : [{
			legend : "",
			props :["spanVal","spanQuery"]
		}]
		},{
		title : "备注",
		fset : [{
			legend : "",
			props :["remark"]
		}]}]		
	},	
	cfg_grid:{
		hide: ["tmCreate","tmModify","remark"]
	},
	cfg_prop:{
	"id":{
	  display:'id',
	  cfg:{
	  	readOnly:true
	  }
	},
	"mid":{
	 display:"设备类型id"
	},
	"name":{
	 display:"参数名称"
	},
	"dispalyname":{
	 display:"参数显示名称"
	}, 
	"style":{
	 display:"参数显示类型",
		editor : 'ComboBox',
		renderer : function(val) {				
		  var dtxt = {						
			'文本框':'文本框','下拉框':'下拉框','无':'无'};
			return dtxt[val];
		},
		cfg :BView.func_cfg_combo([['文本框', "文本框"],['下拉框','下拉框'],['无','无']])
	},
	"styleParam":{
	 display:"类型补充值"
	},
	"valtype":{
	 display:"参数值类型",
		editor : 'ComboBox',
		renderer : function(val) {				
		  var dtxt = {						
			'Integer':'Integer','String':'String'};
			return dtxt[val];
		},
		cfg :BView.func_cfg_combo([['Integer', "Integer"],['String','String']])
	},
	"ordernum":{
	 display:"显示顺序"
	},
	"vaildconditon":{
	 display:"参数有效条件"
	},
	"rule":{
	 display:"参数转换规则"
	},
	"coefficient":{
	 display:"系数"
	},
	"unit":{
	 display:"计量单位"
	},
	"oid":{
	 display:"oid"
	},
	"tmModify":{
	  editor:"DateField",
	  display:'更新时间',
	  dcfg:{
		readOnly:true
	 }
	},	
	"tmCreate":{
	  editor:"DateField",
	  display:'建立时间',
	  dcfg:{
		readOnly:true
	 }
	},"remark":{
	  display:'备注',
	  editor:"TextArea"
	}
  }
 },
 "dao.hb.OAttachment":{
 	func_setdefault:function(robj,objs){
		objs[0].items.map["entityName"]="dao.hb.OStation";
	},
	req:{
		"pss" : [["id","entityName", "entityId","name","stype", "size","path","status","tmCreate","tmModify","remark"]],
		"cns" : ["dao.hb.OAttachment"],
		"hql" : "from OAttachment"
	},
	cfg_detail:{
	btns:["保存"],
	tabs:[{
		title : "基本信息",
		fset : [{
			legend : "",
			props :["id","entityName", "entityId","name","stype", "size","path","status","tmCreate","tmModify"]
		}]
		},{
		title : "备注",
		fset : [{
			legend : "",
			props :["remark"]
		}]
	}]},
	cfg_grid:{
		btns:['增加','删除','打开','保存','检索','刷新',{
	   		text: '绑定',
	        cls: 'x-btn-text-icon',
	        icon: 'icons/connect.png',
			handler : function(btn){
              var ui=btn.ui;
			  var sels=btn.ui.grid.getSelectionModel().getSelections();
			  if(!sels || sels.length==0){
			  	return;
			  }
			  var its = sels[0].obj.items.map;
			  var prs;
			  //选中的是绑定js附件
			  if(its.entityName=="dao.hb.OAttachment"){
			  	prs = "pid="+its.entityId+"&jid="+its.id;
			  	if(its.path){
			  		prs+="&jurl="+its.path;
			  	}
			  }else{//选定底图附件
			  	prs = "pid="+its.id;
			  	if(its.path){
			  		prs+="&purl="+its.path;
			  	}
			  }
			  var jwin = window.open("../ol/bind_edit.html?"+prs, "bind_edit");
			}},{
	   		text: '显示',
	        cls: 'x-btn-text-icon',
	        icon: 'icons/monitor.png',
			handler : function(btn){
              var ui=btn.ui;
			  var sels=btn.ui.grid.getSelectionModel().getSelections();
			  if(!sels || sels.length==0){
			  	return;
			  }
			  var its = sels[0].obj.items.map;
			  var prs;
			  //选中的是绑定js附件
			  if(its.entityName=="dao.hb.OAttachment"){
			  	prs = "pid="+its.entityId+"&jid="+its.id;
			  	if(its.path){
			  		prs+="&jurl="+its.path;
			  	}
			  }else{//选定底图附件
			  	prs = "pid="+its.id;
			  	if(its.path){
			  		prs+="&purl="+its.path;
			  	}
			  }
			  var jwin = window.open("../ol/bind_view.html?"+prs, "bind_view");
			}}],
		hide: ["tmCreate","tmModify","remark"]
	},
	cfg_prop:{
	"id":{
	  display:'序号',
	  cfg:{
	  	readOnly:true
	  }
	},
	"status":{
	 display:"状态",
		editor : 'ComboBox',
		cfg :BView.func_cfg_combo([['启用', 1], ['禁用', 0]])
	},
	"entityName":{
	 display:'数据库表',
	 	  cfg:{
	  	readOnly:true
	 },
	 editor : 'ComboBox',
	 cfg :BView.func_cfg_combo_hql("LIST_ENTITYS","id")
	},
	"entityId":{
	 display:"记录编号"
	},
	"name":{
	 display:"附件名"
	},
	"stype":{
	 display:"附件分类"
	},
	"size":{
	 display:"文件长度"
	},
	"path":{
		display:'附件路径',
		editor:"FileField"
	},
	"tmModify":{
	  editor:"DateField",
	  display:'更新时间',
	  dcfg:{
		readOnly:true
	 }
	},	
	"tmCreate":{
	  editor:"DateField",
	  display:'建立时间',
	  dcfg:{
		readOnly:true
	 }
	},"remark":{
	  display:'备注',
	  editor:"TextArea"
	}
  },child_views : [{
  	title:"相关附件",
  	vn:"dao.hb.OAttachment",
	func_filter: function(robj, ui) {
		var cn = robj.cns[0];
		var hql = " from OAttachment where entityName='"
		+ robj.cns[0]+"' and entityId=" + (robj.items.map['id'] || 0);		
		ui.setHQL(hql);
	},
	func_setdefault:function(robj,objs){
		objs[0].items.map["entityName"]="dao.hb.OAttachment";
		objs[0].items.map["entityId"]=robj.items.map['id'];
	}
  }]
 },
 "dao.hb.LSync":{
		req:{
			"pss" : [["id","uid","dtCreate","entity","entityId","oper","remark","ipaddr"]],
			"cns" : ["dao.hb.LSync"],
			"hql" : "from LSync order by id desc"
		},
		cfg_detail:{	
		tabs:[{
			title:'基本信息',
			props:["id","dtCreate","entity","entityId","oper","remark","ipaddr","uid"]
	 	}]},
		cfg_grid:{
			propNames:["id","dtCreate","uid","entity","entityId","oper","ipaddr"],
			btns:['检索','刷新']
		},
		cfg_prop:{
	    "remark":{
	       display:"备注",
	       editor:"DisplayField"
	    },
		"id":{
		   display:'序号',
		   editor:"DisplayField"
		},
		"uid":{
			display:"操作人",
		    editor:'ComboBox',
		    dcfg:{readOnly:true,readOnlyCls:'form_date_readonly'},
		    renderer : function(itxt,r,col,l) {	

				  		var its = r.record?r.record.data:r.item||{};

				  		return  BView.data_tasks_map[its.uid];

			},
		    cfg:{
	        	lazyInit:false,
	        	emptyText :'请选择',
	        	displayField:'name',
	        	valueField:'id',
	        	triggerAction:'all',
	        	typeAhead :true,
	        	minChars:1,
	        	dcfg:{
	   			  allowBlank:false
	   		    },
	        	listConfig: {
			        getInnerTpl: function() {
			           // return '<div data-qtip="{name}. {pyh}">{name} ({id})</div>';
			        	return '<div data-qtip="{name}. {pyh}">{name}</div>';
			        }
			    },
	        	store:{
			        fields: ['id','uid','name','pyh'],
			        proxy: {
			           //异步获取数据，这里的URL可以改为任何动态页面，只要返回JSON数据即可
			            type: 'ajax',
			            url: CFG.app_ctx+'servlet/JSonBaseServlet?hql=select id,userId,name,namePyh from UUser  ',
			            reader: {
			                type: 'array',
			                root: 'list'
			            }
			        },
			        sorters: [{
	                    property: 'pyh',
	                    direction: 'ASC'
	                }],
			        autoLoad: true
			    },
			    listeners: {
			 		'change':{
			 			fn:function(ctl, val,val_old,eOpts){
			 				//console.log(val);
			 			}
			 		}
			 	}
			    
		    }},
		"ipaddr":{
			display:'IP地址',
			editor:"DisplayField"
		},
		"entity":{
		   display:'数据类',
		   dcfg:{readOnly:true,readOnlyCls:'form_date_readonly'},
		   width:150,
		   editor:'ComboBox',
		   cfg:BView.func_cfg_combo()
		},
		"entityId":{
		    display:"数据标识",
		  	editor:'DisplayField'
		},
		"oper":{
		  display:"动作",
		  dcfg:{readOnly:true,readOnlyCls:'form_date_readonly'},
		  editor : 'ComboBox',
		  cfg :BView.func_cfg_combo([['增加', 65], ['删除', 82],['修改',85]])
		},
		"dtCreate":{
		  editor:"DateField",
		  display:'时间',
		  cfg:{readOnly:true,readOnlyCls:'form_date_readonly'}
		}
		
	  }
	 },
    "dao.hb.LSync1":{
	req:{
		"pss" : [["id","dtCreate","entity","entityId","oper","remark","ipaddr"],["name"]],
		"cns" : ["dao.hb.LSync","dao.hb.UUser"],
		"hql" : "from LSync A,UUser B where A.uid = B.id order by A.id desc"
	},
	cfg_detail:{	
	tabs:[{
		title:'基本信息',
		props:["A.id","A.dtCreate","A.oper","A.entity","A.entityId","A.ipaddr"]
 	}]},
	cfg_grid:{
		propNames:["A.id","B.name","A.dtCreate","A.oper","A.entity","A.entityId","A.ipaddr"],
		btns:['检索','刷新']
	},
	cfg_prop:{
    "A.remark":{
       display:"备注",
       editor:"DisplayField"
    },
	"A.id":{
	   display:'序号',
	   editor:"DisplayField"
	},
	"A.ipaddr":{
		display:'IP地址',
		editor:"DisplayField"
	},
	"A.entity":{
	   display:'数据类',
	   dcfg:{readOnly:true,readOnlyCls:'form_date_readonly'},
	   width:150,
	   editor:'ComboBox',
	   cfg:BView.func_cfg_combo()
	},
	"A.entityId":{
	    display:"数据标识",
	  	editor:'DisplayField'
	},
	"A.oper":{
	  display:"动作",
	  dcfg:{readOnly:true,readOnlyCls:'form_date_readonly'},
	  editor : 'ComboBox',
	  cfg :BView.func_cfg_combo([['增加', 65], ['删除', 82],['修改',85]])
	},
	"A.dtCreate":{
	  editor:"DateField",
	  display:'时间',
	  cfg:{readOnly:true,readOnlyCls:'form_date_readonly'}
	},
	 "B.name":{
	  editor:"DisplayField",
	  display:'操作人',
	  hidden:false
	 }
  }
 },
 
 "dao.hb.LAlarm":{
	req:{
		"pss" : [["id","dtCreate", "oid","remark","propName","propVal", "level"],[],["name"]],
		"cns" : ["dao.hb.LAlarm","dao.hb.ODevice","dao.hb.OLocation"],
		"hql" : "from LAlarm A,ODevice B,OLocation C where A.oid = B.id and B.sid=C.id"
	},
	cfg_detail:{	
	tabs:[{
		title : "基本信息",
		fset : [{
			legend : "",
			props :["A.id","A.dtCreate","C.name", "A.oid","A.remark","A.propName","A.propVal", "A.level"]
		}]
		},{
		title : "备注",
		fset : [{
			legend : "",
			props :["remark"]
		}]
	}]},
	//cfg_prop_all:{cfg:{readOnly:true}},
	cfg_grid:{
		btns:['增加','保存','检索','刷新','排序','图表'//,BView.getBtnForExcel({id:"id",obj:"dao.hb.LAlarm",item:"[filter,single,currentPage,all]"})
		],
		hide: ["classname"]
	},
	cfg_prop:{
	"A.id":{
	  display:'序号'
	},
	"A.classname":{
	 display:'状态类名'
	},
	"A.oid":{
	 display:"设备ID"
	},
	"C.name":{
	 display:"位置"
	},
	"A.propName":{
	 display:"属性名"
	},
	"A.propVal":{
	 display:"属性值"
	},
	"A.level":{
	 display:"报警级别"
	},
	"A.dtCreate":{
	  editor:"DateField",
	  display:'报警时间',
	  width:150
	},"A.remark":{
	  display:'内容',
	  editor:"TextArea",
	  width:250
	 }
  }
 },
 "dao.hb.UUser":{	
 	cn:'用户表',
 	/**
 	close_other:true,dao
 	width:500,
  	handles:{'before_setobj_detail':function(ui,editors,obj){
  		//editors['dtResolved'][0].setReadOnly(false);
  		if(layout.uid==obj.items.map['uid'])
  			BView.setEnableFields(editors,['id','avatar'],false);
  		else
  			BView.setEnableFields(editors,['avatar'],true);
     }
  	},**/
	req:{
		"pss" : [["id","dpt","name","sex","baogf","userId","gid","uid","pwd","wkState","wkYears","birth","year","email","lang","tel","phone","qq","status","online","dtLogin","dtLogout","dtCreate","dtModify","remark","handle","avatar","subbgfFlag"]],
		"cns" : ["dao.hb.UUser"],
		"hql" : "from UUser"
	},
	cfg_detail:{
		btns:["保存"],
		tabs:[
		/**{
	//layout test
	title:'column layout',
	items:[{
        layout:'column',
        border:false,
        items:[{
            columnWidth:.3,
            layout: 'form',
            border:false,
            props :["id","userId"]

        },{
            columnWidth:.3,
            layout: 'form',
            border:false,
            props :["gid","pwd"]

        },{
            columnWidth:1,
            layout: 'form',
            border:false,
            props :["dtCreate"]

        }]	            
	},{
		xtype:'tabpanel',
		defaults : {
			bodyStyle : 'padding:10px'
		},
        plain:true,
        activeTab: 0,
        height:235,
        tabs:[
		{title:'tab1',props :["id","userId"]},
		{title:'tab2',props :["gid","pwd"]}]
	}]},//layout test end**/
		{
		title : "基本信息",
		fset : [{
			legend : "",
			props :["id","userId","name","sex","dpt","wkYears","baogf","subbgfFlag","wkState","dtLogin","dtLogout","dtCreate","dtModify"]
		}]
		}
		/**,{
		title : "联系方式",
		fset : [{
			legend : "",
			props :["email","tel","phone","qq"]
		}]
		},{
		title : "备注",
		fset : [{
			legend : "",
			props :["remark"]
		}]
	}**/]},
	cfg_grid:{
		propFilter:["id","name","sex","dpt","wkYears","baogf","subbgfFlag","wkState"],
		btns:[{
	   		text: '留言',
	        cls: 'x-btn-text-icon',
	        icon: 'icons/comments.png',
			handler : function(btn){
			  var ui=btn.ui;
			  var sels=BView.getSels(btn);
			  var val_to,name_to;
			  if(!sels || sels.length==0){
			  	val_to=null;
			  	name_to="全部";
			  }
			  else{
			  	val_to = [];
			  	name_to= "";
			  	for(var i=0;i<sels.length; i++){
			  		var im = sels[i].obj.items.map;
			  		val_to[val_to.length]=im["id"];
			  		if(i==0)
			  			name_to+=im["name"];
			  		else 
			  			name_to+=";"+im["name"];
			  	}
			  }
			  BView.sendMessage("SendTo","发送留言到["+name_to+"]",{title:"",content:"",offline:true},{to:val_to});
		    }
		   },'检索','刷新'],
		hide: ["pwd","tmCreate","tmModify","remark","handle","uid","lang","tel","phone","msn","qq"]
		
	},
	cfg_prop:{
	"gid":{
	 display:'用户组',
	 editor : 'ComboBox',
	 hidden:true,
	 cfg :BView.func_cfg_combo_hql("select id,name from UGroup order by id","id")
	},
	"id":{
	  display:'序号',
	  editor:"DisplayField",
	  cfg:{
	  	readOnly:true
	  }
	},	
	"subbgfFlag":{
		display:"包干费扣除状态",
		editor : 'ComboBox',
		width:90,
		cfg :BView.func_cfg_combo([['已扣除','false'],['未扣除','true']]),
		renderer:function(val){
			if(val){
				if(val=="false"){
					return "已扣除";
				}
				    return "未扣除";
			}
		}
		
	},
	"email":{
		hidden:true
	},
	"baogf":{
		display:"包干费"
	},
	"avatar":{
	  display:'头像',
	  editor:"FileField",
	  height:200,
	  width:200,
	  hidden:true
	},	
	"userId":{
	  display:'用户名'
	 	},	
	"dpt":{
	  display:'部门'
	},	
	"uid":{
		display:"操作人编号",
		hidden:true
	},
	"sex":{
		display:"性别",
		 editor : 'ComboBox',
		  width:90,
		   dcfg:{
			 allowBlank:false
		 },
		  cfg :BView.func_cfg_combo([['男','男'],['女','女']])
	},
	"year":{
		display:"当前年份",
		hidden:true
	},
	"phone":{
		display:"手机",
		hidden:true
	},
	"qq":{
		display:"QQ",
		hidden:true
	},
	"wkState":{
		display:"在职状态",
		  editor : 'ComboBox',
		  width:90,
		   dcfg:{
			 allowBlank:false
		 },
		  cfg :BView.func_cfg_combo([['在职','在职'],['退休','退休'],['已注销','已注销']])
	},
	"wkYears":{
		display:"工龄"
	},
	"birth":{
		   editor:"DateField",
		   display:"出生日期",
		   hidden:true,
		   renderer:BView.render_date,
		  dcfg:{
			  readOnly:true
		  }
	},
	"pwd":{
	  display:'用户密码',
	  cfg:{
	  	inputType:'password'
	  },
	  hidden:true
	},	
	"name":{
	  display:'真实姓名',
	   cfg:{
			 allowBlank:false
		 }
	 
	},
	"lang":{
	  display:"语种",
	 editor : 'ComboBox',
	 cfg :BView.func_cfg_combo_hql("LIST_LANG_","id"),
	 hidden:true
	},
	"tel":{
	  display:'电话',
	  hidden:true
	},	
	
	
	"online":{
	  display:'在线吗',
	  hidden:true,
	  cfg:{
	  	readOnly:true
	  },
	  renderer : function(itxt,r,col,l) {	
	  	if(!col)
	  		return itxt;
	  	if(itxt==1)
	  		return "<img src=\"icons/status_online.png\"/>";
	  	else
	  		return "<img src=\"icons/status_offline.png\"/>";
	  }
	},	
	"status"://BView.cfg_status,
	{
		display:'状态',
		editor:'Checkbox',
		hidden:true
	},
	"remark":{
	  display:'备注',
	  editor:"TextArea",
	  hidden:true
	},	
	"handle":{
	  display:'登录令牌',
	  cfg:{
	  	readOnly:true
	  },
	  hidden:true
	},	
	"dtModify":{
		   editor :"DisplayField",
		   renderer:function (val) {
				  if(val=="")
					   return "";
					if (val){					
						if(typeof val=='string'){
							val=this.item.dtModify;
						}
							var dt = new Date();
		    			    dt.setTime(val);
							return Ext.Date.format(dt,'Y-m-d H:i');
					}
				  },
	  display:'更新时间',
	  dcfg:{
		readOnly:true
	 },
	 hidden:true
	},	
	"dtCreate":{
		   editor :"DisplayField",
		   renderer:function (val) {
				  if(val=="")
					   return "";
					if (val){					
						if(typeof val=='string'){
							val=this.item.dtCreate;
						}
							var dt = new Date();
		    			    dt.setTime(val);
							return Ext.Date.format(dt,'Y-m-d H:i');
					}
				  },
	  display:'建立时间',
	  dcfg:{
		readOnly:true
	 },
	 hidden:true
	},	
	"dtLogin":{
		   editor :"DisplayField",
		   renderer:function (val) {
				  if(val=="")
					   return "";
					if (val){					
						if(typeof val=='string'){
							val=this.item.dtLogin;
						}
							var dt = new Date();
		    			    dt.setTime(val);
							return Ext.Date.format(dt,'Y-m-d H:i');
					}
				  },
	  display:'最近登入',
	  dcfg:{
		readOnly:true
	 },
	 hidden:true
	},
	"dtLogout":{
		   editor :"DisplayField",
		   renderer:function (val) {
				  if(val=="")
					   return "";
					if (val){					
						if(typeof val=='string'){
							val=this.item.dtLogout;
						}
							var dt = new Date();
		    			    dt.setTime(val);
							return Ext.Date.format(dt,'Y-m-d H:i');
					}
				  },
	  display:'最近退出',
	  dcfg:{
		readOnly:true
	 },
	 hidden:true
	}			
  }
 },
 "dao.hb.UGroup":{
	req:{
		"pss" : [["id", "name","dtCreate","dtModify","remark"]],
		"cns" : ["dao.hb.UGroup"],
		"hql" : "from UGroup"
	},
	cfg_detail:{
		 btns:["保存"]
	},
	cfg_grid:{
		btns:['增加','删除','打开','保存','检索','刷新'],
		hide: ["remark"]
	},
	cfg_prop:{
	"id":{
	  display:'序号',
	  cfg:{
	  	readOnly:true
	  }
	},
	"name":{display : '命名'},
	"dtModify":{
	  editor:"DateField",
	  display:'更新时间',
	  dcfg:{
		readOnly:true
	 }
	},	
	"dtCreate":{
	  editor:"DateField",
	  display:'建立时间',
	  dcfg:{
		readOnly:true
	 }
	},"remark":{
	  display:'备注',
	  editor:"TextArea"
	}

  },child_views : [{
  	title:"相关权限",
  	vn:"dao.hb.UGrant",
	func_filter: function(robj, ui) {
		var cn = robj.cns[0];
		var hql = " from UGrant where gid=" + (robj.items.map['id'] || 0);		
		ui.setHQL(hql);
	},
	func_setdefault:function(robj,objs){
		objs[0].items.map["gid"]=robj.items.map['id'];
	}
  }]
 },

 "dao.hb.UGrant":{
	req:{
		"pss" : [["id", "gid","pmMenu","pmEntity","pmOper","dtCreate","dtModify","remark"]],
		"cns" : ["dao.hb.UGrant"],
		"hql" : "from UGrant"
	},
	cfg_detail:{
	btns:["保存"],
	tabs:[{
		title : "基本信息",
		fset : [{
			legend : "",
			props :["id", "gid","pmMenu","pmEntity","pmOper","dtCreate","dtModify"]
		}]
		},{
		title : "备注",
		fset : [{
			legend : "",
			props :["remark"]
		}]
	}]},
	cfg_grid:{
		hide: ["dtCreate","dtModify","remark"]
	},
	cfg_prop:{
	"id":{
	  display:'序号',
	  cfg:{
	  	readOnly:true
	  }
	},
	"gid":{
	 display:'用户组',
	 editor : 'ComboBox',
	 cfg :BView.func_cfg_combo_hql("select id,name from UGroup order by id","id")
	},
	"pmMenu":{
	 display:'功能菜单',
	 editor : 'ComboBox'//,
	 //cfg :BView.func_cfg_combo("LIST_ENTITYS","id")
	},
	"pmEntity":{
	 display:'数据库表',
	 editor : 'ComboBox',
	 cfg :BView.func_cfg_combo_hql("LIST_ENTITYS","id")
	},
	"pmOper":{
	 	display:'操作',
		editor : 'ComboBox',
		renderer : function(val) {				
		  var dtxt = {						
			'1':'查看',	
			'2':'修改',
			'3':'增删'
			};
			return dtxt[val];
		},
		cfg :BView.func_cfg_combo([["查看", 1], [ "修改",2], ["增删",3 ]])
	},
	"dtModify":{
	  editor:"DateField",
	  display:'更新时间',
	  dcfg:{
		readOnly:true
	 }
	},	
	"dtCreate":{
	  editor:"DateField",
	  display:'建立时间',
	  dcfg:{
		readOnly:true
	 }
	},"remark":{
	  display:'备注',
	  editor:"TextArea"
	}
	
  }
 },

 "dao.hb.MMessage":{
	req:{
		"pss" : [["id", "uid","mid","online","stype","sendTo","title","content","tmCreate","tmModify","tmReply","rname","status"]],
		"cns" : ["dao.hb.MMessage"],
		"hql" : "from MMessage order by id desc"
	},
	cfg_prop_all:{cfg:{readOnly:true}},
	cfg_detail:{tabs:[{
		title : "基本信息",
		fset : [{
			legend : "",
			props :["id", "uid","online","stype","sendTo","title","tmCreate","tmModify","status"]
		}]
		},{
		title : "留言内容",
		fset : [{
			legend : "",
			props :["content"]
		}]
		}]},
	cfg_grid:{
		btns:['打开',{
	   		text: '用户组留言',
	        cls: 'x-btn-text-icon',
	        icon: 'icons/comments.png',
			handler : function(btn){
			  BView.sendMessage("SendToGroup","发送留言到用户组",{sendToGroup:"",title:"",content:""},{offline:"on"});
			}
        } ,'检索','刷新','排序'],
        btn_revise: function(b){ if(b.text=='编辑') b.text='查看' },
		hide: ["content","tmCreate","tmModify"]
	},
	cfg_prop:{
	"id":{
	  display:'序号',
	  cfg:{
	  	readOnly:true
	  }
	},
	"uid":{
	 display:'用户'
	},
	"mid":{
	 display:'主留言id'
	},
	"title":{
	 display:'留言题名'
	},
	"content":{
	 display:'留言内容',
	 editor:"TextArea"
	},
	"pmMenu":{
	 display:'功能菜单',
	 editor : 'ComboBox'//,
	 //cfg :BView.func_cfg_combo("LIST_ENTITYS","id")
	},
	"online":{
	 display:'在线消息'
	},
	"sendTo":{
	 display:'目标用户(组)'
	},
	"stype":{
	 	display:'类型',
		editor : 'ComboBox',
		renderer : function(val) {				
		  var dtxt = {						
			'1':'系统通知',	
			'2':'业务沟通',
			'3':'问候'};
			return dtxt[val];
		},
		cfg :BView.func_cfg_combo([["系统通知", 1], [ "业务沟通",2], ["问候",3 ]])
	},
	"tmModify":{
	  editor:"DateField",
	  display:'更新时间'
	},	
	"tmCreate":{
	  editor:"DateField",
	  display:'建立时间'
	},"tmReply":{
		editor:"DateField",
	  	display:'回复时间'
	},"rname":{
	  display:'回复人'
	},"status":{
	  display:'状态'
	}
	
  },child_views : [{
  	title:"相关回复",
  	vn:"dao.hb.MMessage",
	func_filter: function(robj, ui) {
		var hql = " from MMessage where mid=" + (robj.items.map['id'] || 0);		
		ui.setHQL(hql);
	} }]
 },
  "dao.hb.MInbox":{
  	handles:{'before_save':function(ui){
  		//将如果查看时间为空,设置为已查看
    		for(var i=0,len=ui.objs.length;i<len;i++){
    			var cur = ui.objs[i];
    			if(cur.action=='O'&& cur.items.map["A.tmCheck"]==null){
    				cur.action='U';
    			}
    		}
    	}
    },
	req:{
		"pss" : [["id", "mid","uid","tmCheck"],["id","uname","stype","title","tmCreate","content"]],
		"cns" : ["dao.hb.MInbox","dao.hb.MMessage"],
		"hql" : "from MInbox A, MMessage B where A.mid=B.id order by A.id desc"
	},
	cfg_detail:{
	 btns:[{
	   		text: '回复',
	        cls: 'x-btn-text-icon',
	        icon: 'icons/email_go.png',
			handler : function(btn){
			 var im = this.obj_detail.items.map;
			 var uiDetail=this;
			 BView.sendMessage("Re","回复留言["+im["A.mid"]+"]",{title:"Re:"+im["B.title"],content:""},{mid:im["A.mid"],offline:"on",to:[im["B.id"]]},
			 	function(){
			 		var ap = layout.tabPanel.getActiveTab();
		 			layout.tabPanel.remove(ap,false);
			 	});
			}},{
	   		text: '转发',
	        cls: 'x-btn-text-icon',
	        icon: 'icons/email_link.png',
			handler : function(btn){
			 var im = this.obj_detail.items.map;
			 BView.sendMessage("forward","转发留言["+im["A.mid"]+"]",{sendToGroup:"",title:"Fw:"+im["B.title"],content:im["B.content"]},{offline:"on"},
			 function(){
			 		var ap = layout.tabPanel.getActiveTab();
		 			layout.tabPanel.remove(ap,false);
			 });
			}}],
	 tabs:[{
		title : "基本信息",
		fset : [{
			legend : "",
			props :["A.id", "A.mid","A.uid","A.tmCheck","B.uname","B.stype","B.title","B.tmCreate","B.content"]
		}]
		},{
		title : "留言内容",
		fset : [{
			legend : "",
			props :["B.content"]
		}]
		}]},
	cfg_prop_all:{cfg:{readOnly:true}},
	cfg_grid:{
		btns:['打开',{
	   		text: '回复',
	        cls: 'x-btn-text-icon',
	        icon: 'icons/email_go.png',
			handler : function(btn){
			  var sels=btn.ui.grid.getSelectionModel().getSelections();
			  if(!sels || sels.length==0){
			  	return false;
			  }
			  var im = sels[0].obj.items.map;
			  BView.sendMessage("Re","回复留言["+im["A.mid"]+"]",{title:"Re:"+im["B.title"],content:""},{mid:im["A.mid"],offline:"on",to:[im["B.id"]]});
			}},{
	   		text: '转发',
	        cls: 'x-btn-text-icon',
	        icon: 'icons/email_link.png',
			handler : function(btn){
			  var sels=btn.ui.grid.getSelectionModel().getSelections();
			  if(!sels || sels.length==0){
			  	return false;
			  }
			  var im = sels[0].obj.items.map;
			  BView.sendMessage("forward","转发留言["+im["A.mid"]+"]",{sendToGroup:"",title:"Fw:"+im["B.title"],content:im["B.content"]},{offline:"on"});
			}},'检索','刷新','排序'],
		btn_revise: function(b){ if(b.text=='编辑') b.text='查看' },
		hide: ["B.content"]
	},
	cfg_prop:{
	"A.id":{
	  display:'序号'
	},
	"A.mid":{
	  display:'留言序号'
	},
	"A.uid":{
	  display:'目标用户'
	},
	"A.tmCheck":{
	  display:'查看时间',
	  editor:"DateField"
	},
	"B.id":{
	  display:'留言序号'
	},
	"B.uname":{
	  display:'留言者'
	},
	"B.stype":{
	  display:'留言类型'
	},
	"B.title":{
	  display:'留言题名'
	},
	"B.content":{
	  display:'留言内容',
	  editor:"TextArea"
	},
	"B.tmCreate":{
	  display:'留言时间',
	  editor:"DateField"
	}
  },child_views : [{
  	title:"相关回复",
  	vn:"dao.hb.MMessage",
	func_filter: function(robj, ui) {
		var cn = robj.cns[0];
		var hql = " from MMessage where mid=" + (robj.items.map['B.id'] || 0);		
		ui.setHQL(hql);
	},
	func_setdefault:function(robj,objs){
		//objs[0].items.map["mid"]=robj.items.map['id'];
	}
  }]
 },
 "dao.hb.YlbxLog":{
		req : {
			"pss" : [
					[ "id", "userid", "opertime", "project", "module","remark" ,"ipaddress","dtLook"]],
			"cns" : [ "dao.hb.YlbxLog" ],
			"hql" : "from YlbxLog order by  id desc"
		},
		cfg_detail : {
			tabs : [ {
				title : '基本信息',
				props : [ "id", "userid", "opertime", "project", "module","remark" ,"ipaddress","dtLook" ]
			} ]
		},
		// cfg_prop_all:{cfg:{readOnly:true}},
		cfg_grid : {
			propNames : [ "id", "userid", "opertime", "project", "module","remark","ipaddress","dtLook" ],
			btns : [ '检索', '刷新', '排序' ]
		},
		cfg_prop : {
			"id" : {
				display : '序号',
				editor : "DisplayField"
			},
			"userid" : {
				display : '操作员',
				width : 100,
				editor : "DisplayField"

			},
			"opertime" : {
				editor : "DateField",
				display : '操作时间',
				cfg : {
					readOnly : true,
					readOnlyCls : 'form_date_readonly'
				}
			},
			"project":{
				display : '项目',
				editor : "DisplayField",
				width:150
			},
			"module" : {
				display : '模块',
				width : 100,
				editor : "DisplayField"
			},
			"remark" : {
				display : "备注",
				width : 350,
				editor : "DisplayField"
			},
			"ipaddress":{
				display:'IP地址',
				editor:"DisplayField"
			},
			"dtLook" :{
				editor : "DateField",
				display : '看病日期',
				cfg : {
					readOnly : true,
					readOnlyCls : 'form_date_readonly'
				}
			}
		}
	}
};

//clone view and modify
var pvw = Bat.clone(BView.viewMap['dao.hb.PTask']);
pvw.cfg_grid.btns=['打开','保存'];
pvw.handles=null;
BView.viewMap['dao.hb.PTask1']=pvw;


var pvw = Bat.clone(BView.viewMap['dao.hb.LSync']);

var bv = BView.viewMap;
var arg=new Array();
var i=0;
for(var key in bv){
	var value=bv[key];
	if(value.cn)
	  arg.push([value.cn,key]);
    
}
pvw.cfg_prop["entity"].cfg=BView.func_cfg_combo(arg);
pvw.cfg_grid.btns=['打开','检索','刷新',BView.getBtnForExcel({id:"id",obj:"dao.hb.LSync",item:"[filter,all]"})];
BView.viewMap['dao.hb.LSync2']=pvw;
